Hi Folks,

This is not OSX-related, but I'm hoping that some OSXer could point 
me in the right direction.  This has to have a RTFM answer but I 
haven't been able to find the FM to R.

I can't figure out how to use a constant in a regular expression 
without having to assign it to a variable first.  Here's what I mean:

#!/usr/bin/perl -w

use strict;
use constant FS => '##';

my $x = 'sadfjsfh##fskdjfa;s##dfjhasfjh';

my $y = FS;
$x =~ s/FS/ZZ/g;
print "1:$x\n";
$x =~ s/FS()/ZZ/g;
print "2:$x\n";
$x =~ s/$y/ZZ/g;
print "3:$x\n";
print FS,"\n";
print FS(),"\n";


Output is:

1:sadfjsfh##fskdjfa;s##dfjhasfjh
2:sadfjsfh##fskdjfa;s##dfjhasfjh
3:sadfjsfhZZfskdjfa;sZZdfjhasfjh
##
##


Thanks,

Warren

Reply via email to