On 1 Nov 2007 at 19:20, Kaushal Shriyan wrote:

> Hi
> 
> I am using FileHandle, Below is my code
> ########################################
> 
> #!/usr/bin/perl
> 
> use warnings;
> use strict;
> 
> open(LOGFILE, "messages")
>         || warn "Could not open messages";
> open(DATA, ">/tmp/data") || die "Could not create /tmp/data\n."
> 
> while (<LOGFILE>) {
>         print "$_\n" if /MARK/;
> }
> #######################################
> 
> I am getting syntax error
> 
> I know i am doing wrong, please let me know whats causing the issue.

Did the error give a line number? I think it's the lack of brackets 
on the if clause.

 while (<LOGFILE>) {
         print "$_\n" if ( /MARK/ );
 }

Hope I'm not too far off.
Dp.


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


Reply via email to