Thanks, that did it
>At 1:20 PM -0400 2002-08-30, Warren Pollans wrote:
>>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.
>
>With Perl, there is always its own internal documentation, in this
>case the POD of constant.pm.
>
>However, :-), a quick scan didn't confirm that this was where I
>learned the answer to your question, which is to de-reference a
>reference to the constant (!!).
>
>#!/usr/bin/perl -w
>use strict;
>use constant FS => '##';
>
>my $x = 'sadfjsfh##fskdjfa;s##dfjhasfjh';
>
>$x =~ s/${ \FS }/ZZ/g; # or ${ \FS() }
># ^^ ^ ^
>print "1:$x\n";
>
>__END__
>
>>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
>
>--
>
> - Bruce
>
>__bruce_van_allen__santa_cruz_ca__