On Thu, 10 Oct 2002, david wrote:

> Sudarshan Raghavan wrote:
> 
> > 
> > You will have to escape the @ and you don't need the /g modifier
> > This can be written as
> > (my $name = basename($file)) =~ s/\@+$//;
> 
> escape the '@' character is unecessary.

Read about the @+ array in perldoc perlvar. You will have to escape
the '@' otherwise it will try to interpolate @+.
Did you try it out? If it is uneccessary why does this happen?

use strict;

while (<STDIN>) {
  chomp;
  s/@+$//;
  print "$_\n";
}

Given the input
abcd@@
It outputs
abcd@@

use strict;

while (<STDIN>) {
  chomp;
  s/\@+$//;
  print "$_\n";
}

Given the input
abcd@@
It outputs
abcd



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to