in reply to RE: Odd...
in thread Odd...

Can't you just use any character (here the space) to delimit a regexp?

Replies are listed 'Best First'.
RE: RE: RE: Odd...
by extremely (Priest) on Sep 20, 2000 at 04:09 UTC

    I think you can only use alternative delimiters if you use the complete form of the regex like:  $a =~ m AreA;

    And then spaces aren't allowed anymore since 5.002 or somesuch. In fact in the above the space is REQUIRED between the "m" and the "AreA" portions or Ovid's bug kicks in and it doesn't parse correctly!

    use strict; my $a = "freak"; my $b = "freakmAreA"; print "Yay!\n" if $a=~m AreA; print "Boo!\n" if $a=~mAreA; print "BUG!\n" if $b=~mAreA;

    The above prints "Yay! and BUG!" in 5.6 under Linux. The "bare" word promotion is happening even when it shouldn't IMHO. Altho reading `perldoc perlop` leads me to believe that it should have not printed "Yay!" either:

    If "/" is the delimiter then the initial m is optional. With the m you can use any pair of non- alphanumeric, non-whitespace characters as delimiters. This is particularly useful for matching path names that contain "/", to avoid LTS (leaning toothpick syndrome). If "?" is the delimiter, then the match-only-once rule of ?PATTERN? applies. If "'" is the delimiter, no interpolation is performed on the PATTERN.

    ... since really ...

    $c =~ s eieioeio; #or $d =~ s ei$oeio$ioeieo;

    ... radiates pure evil. =)

    $you = new YOU;
    honk() if $you->love(perl)

RE: RE: RE: Odd...
by mirod (Canon) on Sep 19, 2000 at 23:37 UTC

    This code actually does not pass -w and use strict on my Solaris/Perl 5.6 combo.

    Are you sure ab is not pre-compiled or some similar trickery?