dogbert has asked for the wisdom of the Perl Monks concerning the following question:
what I want to do is make my pattern a $var and i think i'm supposed to use rq{} to do it. I tried doing the rq{} my self but i just foobared that code. What I'm asking is how would I turn my pattern in a $var. any help or suggjestions would help a lot (I've been through the perlop already) ----------------------------------------------------------- Height : varies depending on my speed relative to the observer Weight : is a sensation caused by the gravitational wrapping of time-space Age : time is only a persistent illusion$file = shift; open(MAT, "<$file") or die "bad file name"; $text = <MAT>; while($text =~ /the/g) { $x += 1; } print "found $x matches\n"; close(MAT);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: regex patterns
by Cabrion (Friar) on Jan 31, 2003 at 02:38 UTC | |
by dogbert (Scribe) on Jan 31, 2003 at 02:45 UTC | |
by Cabrion (Friar) on Jan 31, 2003 at 02:49 UTC | |
|
Re: regex patterns
by crouchingpenguin (Priest) on Jan 31, 2003 at 03:00 UTC | |
|
Re: regex patterns
by Hofmator (Curate) on Jan 31, 2003 at 10:07 UTC | |
by dogbert (Scribe) on Feb 07, 2003 at 21:14 UTC | |
by Hofmator (Curate) on Feb 07, 2003 at 21:30 UTC | |
by dogbert (Scribe) on Feb 14, 2003 at 23:21 UTC |