Sudarshan Raghavan wrote:
> 
> 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


What version of Perl are you using?

$ perl -Mstrict -wle'@+ = qw/b c d/;(my $name = q/a b c d efg@@@@/) =~ s/@+//; print 
$name'
a b c d efg
$ perl -Mstrict -wle'my @a = qw/b c d/;(my $name = q/a b c d efg@@@@/) =~ s/@a//; 
print $name'
a  efg@@@@



John
-- 
use Perl;
program
fulfillment

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

Reply via email to