in reply to Best way to get all of the matches?
I am not sure, something like this?
use strict; use warnings; my $file = 'match alphabets 21211 not numbers'; my $regexp = qr{[a-z]+}; $, ="\n"; print (my (@arr) = $file =~ /($regexp)/g );
Also avoid using, undef $/, for reading file like this, which ll affect your coding in some situations, instead try Perl Idioms Explained - my $string = do { local $/; <FILEHANDLE> };.
Prasad
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Best way to get all of the matches?
by GrandFather (Saint) on Sep 30, 2006 at 18:26 UTC |
In Section
Seekers of Perl Wisdom