Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Perl Question on Pattern Matching

Name: Anonymous 2011-06-03 19:08

Okay this simple thing matches words that has an a e i o u, but how do I make it so that it matches it in the specific order for a e i o u

Example abstemious

foreach $v(@lines)
{
    if(($v =~ /a/) && ($v =~ /e/) && ($v =~ /i/) && ($v =~ /o/) && ($v =~ /u/))
    {
        print $v;
    }
}

Name: Anonymous 2011-06-03 19:36


$a = 2;

sub foo {
    $a = $a+1; # create a local copy of $a, so we wont modify global
    # ...
}

&foo;
print "$a\n"; # this should print '2'

This prints 3, due to a naive mistake that Larry Wall made early on, one that has permanent and far-reaching implications to the usability of the language. For what it's worth, Guido made the same mistake with Python, Matz made it with Ruby, and Strachan appears to be making it all over again in Groovy. It's a common blunder.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List