@+ magic variable

Paul Orrock paulo at digitalcraftsmen.net
Thu Feb 15 13:31:27 GMT 2007


Hi,

We're migrating some client code from 5.6.1 to 5.8.8 and the following 
line has been causing some problems.

The incoming string has lots of @'s padded on the end (don't ask) and 
they need to strip them off.

$str =~ s/@+$//;

This works in 5.6.1 but not in 5.8.8. A bit of search discovers that @+ 
is a magic variable in 5.8.8 so escaping the @ in the regex solves the 
problem.

My question is when did the @+ magic variable come in ?

regards,

Paul

Example code

my $str = 'cbewocg@@@';
$str =~ s/@+$//;
print $str;


More information about the london.pm mailing list