On Thursday 29 April 2004 10:31, Owen wrote:
> I would like to replace all instances of
>
>  @non_space_characters[non_space_characters] with
>  $non_space_characters[non_space_characters]
>
> The program below gets the first one only. How do I get the others?
>
> TIA
>
> Owen
> ---------------------------------------------------
> #!/usr/bin/perl -w
> use strict;
>
> my $line;
> while (<DATA>){
> $line=$_;
> #$line=~s/(@)(\S+)(\[\S+\])/\$$2$3/g;
> $line=~s/(@)(\S+\[\S+\])/\$$2/g;
>
> print "$line\n";
>
> }
> __DATA__
> @[EMAIL PROTECTED]@banana[4];

don't be greedy ;-)

s/\@(\S+?\[\S+?\])/\$$1/g;

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to