in reply to Re: regex question
in thread regex question

Thanks for your replay , but ...

#!/perl/bin/perl -w use strict; my $string = "Hello $ World \n"; $string =~ tr/A-Za-z0-9.-_//cd; print $string; ### ### prints out Global symbol "$World" requires explicit package name

same for the other example

and i have one more question how can i add a space

to s/// in the example you gave to me ?

leaving a space at the end or adding \s giving me errors

Replies are listed 'Best First'.
Re^3: regex question
by davido (Cardinal) on Dec 05, 2006 at 09:10 UTC

    Yes, but if you used the correct type of quotes that wouldn't be a problem:

    my $string = 'Hello $World' . "\n";

    Or escape your $ character.

    By the way, your script is failing on this line:

    my $string = "Hello $World \n";

    That's happening in the compilation phase, not runtime.


    Dave