Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Re: Compiling Regular Expressions

by hv (Parson)
on Feb 19, 2003 at 13:38 UTC ( #236621=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download

  1. or download this
      for (@words) {
        print if /foo/;
  2. or download this
      my $s = "foo";
      for (@words) {
        print if /$s/;
  3. or download this
      my($s1, $s2) = qw/ foo bar /;
      for (@words) {
        print if /$s1/;
        print if /$s2/;
  4. or download this
      my @s = qw/ foo bar /;
      for (@words) {
          print if /$s/;
  5. or download this
      my @s = map qr{$_}, qw/ foo bar /;
      for (@words) {
          print if /$s/;

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://236621]
and a kettle whistles...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (6)
As of 2017-02-27 19:27 GMT
Find Nodes?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?

    Results (392 votes). Check out past polls.