On 1/2/06, John W. Krahn <[EMAIL PROTECTED]> wrote: > Gerard Robin wrote: > > Hello, > > Hello, > > > I guess that one can write in more perlish fashion that I did: the part > > between the #### of this script to pack the array @array. > > > > Please, can someone give me some hint ? > > You don't need to use an array for that: > > my $string = "[EMAIL PROTECTED] n??e#w [?! \$ \% y]e{?]a##r? 2\*0\$0'\"6\# ! > \^"; > > $string =~ tr/ [EMAIL PROTECTED]"^'"][*{/ /sd; > > print "$string\n";
I find it's easier to specify what I want to keep instead of what I need to delete: $string =~ s/[^A-Za-z0-9 ]//g; So the above is pronounced "get rid of everything that isn't A-Z or a-z or 0-9 or a space". -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>