surenbika has asked for the wisdom of the Perl Monks concerning the following question:
I am trying to write a program to print all matching lines of a pattern
#!/usr/bin/perl; use warnings; use strict; my $filename = 'C:\Perl\example.txt'; open (my $fh, '<' ,$filename) or die "ERROR: could not open $filename: + $!"; while (<>) { if (/fred/) { print ; } } close ($fh);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: My program hangs
by Corion (Patriarch) on Jun 23, 2014 at 08:16 UTC | |
|
Re: My program hangs
by vinoth.ree (Monsignor) on Jun 23, 2014 at 10:10 UTC | |
|
Re: My program hangs
by 1s44c (Scribe) on Jun 23, 2014 at 13:13 UTC | |
by Corion (Patriarch) on Jun 23, 2014 at 13:18 UTC |