On Monday 26 November 2007 13:05, lerameur wrote: > Hello, Hello,
> I am trying to use this two line script. The command by itself works, > when I run this script, I get error message: > Use of uninitialized value in concatenation (.) or string at ./ > find_date.pl line 8. > > line 8: my $file_to_print = system "ls -lrt /test/*log | tail -1 | > awk {'print $9'}"; > print $file_to_print; > > then after the error message an erroneous output, showing the correct > file but with all the fields... > how Do I get the script to function as if I where to implement the > command directly. my $dir = '/test'; opendir my $dh, $dir or die "Cannot open '$dir' $!"; my $file_to_print = ( map $_->[ 1 ], sort { $a->[ 0 ] <=> $b->[ 0 ] } map [ -M "$dir/$_", $_ ], grep /log\z/, readdir $dh )[ 0 ]; John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/