On Feb 4, siren jones said: >$a = "144^0.0^100^"; >$a = s/^/_/g; # replace ^ with underscore character for ftp >print "$a,"\n"; > >Here is what gets printed: > >144^0.0^100^
Are you sure it's not _144^0.0^100^ ? I'd expect there to be a _ at the front. >What am I doing wrong with the substitution operator? Thanks in advance. ^ is special to regexes, and means "match the beginning of the string". You needn't use s///g here, you can use tr/// (which does character to character transliteration) instead: $a =~ tr/^/_/; tr/// doesn't use regex syntax, so ^ isn't special here. -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ ** Look for "Regular Expressions in Perl" published by Manning, in 2002 ** <stu> what does y/// stand for? <tenderpuss> why, yansliterate of course. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]