in reply to Re: negative regex without !~
in thread negative regex without !~

I'm fairly sure the $foo !~ m/../ syntax didn't exist in perl 5.0, but my impression to the original poster's question is that it really doesn't relate to perl itself of any version. I used to have to write a lot of backwards compatible code, so this was useful knowledge.... but who's still using 5.0 these days <grin>

Replies are listed 'Best First'.
Re^3: negative regex without !~
by freddo411 (Chaplain) on Jul 22, 2004 at 20:25 UTC
    Works in 5.005

    but who's still using 5.0 these days?

    <sheepishly> Me. Some companies haven't upgraded.... </sheepishly>

    use strict; print 'Perl version is: ', $]; my @foo = qw/ fee fie fo fum big bag boz /; foreach ( @foo ) { if ( $_ !~ /f/ ) { print "Matched: $_ !~ /f/ " ; } else { print "Failed: $_ !~ /f/ " ; } } Output: Perl version is: 5.00503 Failed: fee !~ /f/ Failed: fie !~ /f/ Failed: fo !~ /f/ Failed: fum !~ /f/ Matched: big !~ /f/ Matched: bag !~ /f/ Matched: boz !~ /f/

    -------------------------------------
    Nothing is too wonderful to be true
    -- Michael Faraday

      Perl version 5.00503 is essentially Perl 5.5.3; they changed the release version numbers starting with Perl 5.6.0

Re^3: negative regex without !~
by sgifford (Prior) on Jul 22, 2004 at 18:17 UTC
    No, I recall using !~ even back in Perl 4.