[ Please type your reply *below* the part(s) of the message you are
commenting on. ]

FlashMX wrote:
Gunnar Hjalmarsson wrote:
FlashMX wrote:
Is this correct?

<snip>

What happened when you tried to run it (with strictures and
warnings enabled)?

I had to disable the warnings because I get an error:

Can't locate warnings.pm in @INC at test.pl line 3.
BEGIN failed--compilation aborted at test.pl line 3.

Then you are using an old version of Perl. You can enable warnings via the -w switch at the shebang line instead.

When I disable the warnings my script runs but it doesn't find the
match from my grep even thought the text I'm trying to find IS in the
"input.file" file.

I'm missing something...

Yes, indeed you are. For instance, you seem not to have read the description of the function you are trying to use.

    perldoc -f grep

my $file = 'input.file';

if (grep(/FIND MATCH/i, $file)) {

That tries to match the regex with the string 'input.file'. To check the contents of a file you need to open it.

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to