R
Rodrick Brown
Hello all I have a script that processes the following data I could possibly
speed it up
0107
0205
0304
0405
0105
0805
the script just converts the output to
Jan07
feb05
mar03
apr05
etc...
Here is a sample of how i'm doing this
#!/usr/bin/perl
use warnings;
my %months = ( 1=>"jan", 2=>"feb", 3=>"mar", 4=>"apr", 5=>"may", 6=>"june",
7=>"jul", 8=>"aug", 9=>"sep", 10=>"oct", 11=>"nov",
12=>"dec" );
my $date = "./date.txt";
open LOG, $date or die("unable to open file: $!\n");
while(<LOG>)
{
foreach my $m (keys(%months))
{
if( $m eq substr($_,1,1))
{
my $days = substr($_,2,2);
print "$months{$m}$days\n";
}
}
}
speed it up
0107
0205
0304
0405
0105
0805
the script just converts the output to
Jan07
feb05
mar03
apr05
etc...
Here is a sample of how i'm doing this
#!/usr/bin/perl
use warnings;
my %months = ( 1=>"jan", 2=>"feb", 3=>"mar", 4=>"apr", 5=>"may", 6=>"june",
7=>"jul", 8=>"aug", 9=>"sep", 10=>"oct", 11=>"nov",
12=>"dec" );
my $date = "./date.txt";
open LOG, $date or die("unable to open file: $!\n");
while(<LOG>)
{
foreach my $m (keys(%months))
{
if( $m eq substr($_,1,1))
{
my $days = substr($_,2,2);
print "$months{$m}$days\n";
}
}
}