in reply to What does this mean?
#! usr/bin/perl use strict; use warnings; my $search_term = 'Smith'; #no need to open the DATA handle, you can simply start reading it... for my $line (<DATA>){ print $line if $line =~ m{$search_term} ; } __DATA__ Fred Smith Jane smith Bob Smitters Joe Smith __END__ This is the output I'm getting: C:\Temp>perl test.pl Fred Smith Joe Smith But I was expecting: Fred Smith Jane smith Joe Smith
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: What does this mean?
by almut (Canon) on Mar 01, 2010 at 11:40 UTC | |
|
Re^2: What does this mean?
by bart (Canon) on Mar 01, 2010 at 12:49 UTC | |
by Cuhulain (Beadle) on Mar 01, 2010 at 14:14 UTC | |
by desemondo (Hermit) on Mar 01, 2010 at 22:19 UTC | |
by biginingperl (Initiate) on Mar 01, 2010 at 13:25 UTC |