in reply to Parsing Unstructured Data
If you do that, you'll see that you need to explicitly define @jobs, $date, $job, @jobs and $date.
If you want to test with a DATA block, you need to change from <FH1> to <DATA>.
Then you'll get uninitialized values for your substitution defining, and later using, $date.
I took the liberty of changing
my $date =~ s/\[//;
to
my $date =''; if ( $_ =~ /\[(\S+)\s/ ) { $date = $1; }
This will get you to the point where you'll be able to start debugging your code. Keep in mind that get_cur_time returns a value of the form MM/DD/YY, while $date will contain a value of M/DD/YY. Fixing this is left as an exercise to the reader.
Please realize that print statements are your friend. So is the Perl debugger.
Good luck with your project.
|
|---|