> -----Original Message-----
> From: Sudarshan Raghavan [mailto:[EMAIL PROTECTED]]
> Sent: Friday, October 11, 2002 3:58 PM
> To: Perl beginners
> Subject: RE: excluding @@
> 
> 
> 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@@
> 

not for me (ActivePerl Build 631)
it prints '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]
> 

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

Reply via email to