At 16:12 2002.06.05, Shishir K. Singh wrote:
>open (FILE , "<$ARGV[0]");
>print "ok" if ( map { /Date:/ } (<FILE>) );
>close FILE;
map return an array with the result of the express apply to each line. Even if none of
the lines in <FILE> contain Date:, you will have an array with one "" value for each
line. This is a non empty array i.e. it has multiple lines and when evaluate in a
scalar context (with the if() ), it would always be true unless there are no lines in
<FILE>.
I think you want grep there as in
print "ok" if (grep /Date:/ ,(<FILE>));
or
print "ok" if (map { /Date:/ ? $_ : () } , (<FILE>));
I may be wrong though.
Best
----------------------------------------------------------
�ric Beaudoin <mailto:[EMAIL PROTECTED]>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]