in reply to Re^2: Matching Regular expression at EOF
in thread Matching Regular expression at EOF
No... its not on a single variable... i am opening the file and reading it line by line...
Try:
my $last_line = undef;
while( <$fh> ){
$last_line = $_;
# process file contents, if needed
}
if( defined $last_line ){
$last_line =~ m/$pat\z/;
}else{
warn "file is empty\n";
}
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Matching Regular expression at EOF
by ikegami (Patriarch) on Feb 20, 2010 at 20:06 UTC |