lina wrote:
On Sun, Feb 19, 2012 at 3:34 AM, Shawn H Corey<shawnhco...@gmail.com>  wrote:
On 12-02-18 11:40 AM, lina wrote:

      elsif ( $xpm_file =~ /^"(\S+)[",]$/) {

Are there some possibilities that something can be done for the part [",]?

Make it recognize both end with " or ",


  elsif( $xmp_file =~ /^\"([A-Za-z]+)\"\,?$/ ){
    my $keys = $1;
    my @result = ();
    for my $key ( $keys =~ /(.)/g ){
      if( defined( $dict{$key} )){
        push @result, $dict{$key};
      }
    }
    $xmp_file = join( q{ }, @result );


Thanks, I spent some time to get understanding.


        elsif ( $xpm_file =~ /^\"([A-Za-z]+)\"\,?$/) {
                $xpm_file =~ s/([A-Za-z])/$dict{$1}/g;
                $xpm_file =~ s/[",]//g;
                print $xpm_file;
                }
}

can below be done in perl,

$x =~ {s/a/b/g; s/c/d/g }

put several together,

No.  But you could do this:

$x =~ tr/ac/bd/;

Or if you really want to use substitution:

s/a/b/g, s/c/d/g for $x;


John
--
Any intelligent fool can make things bigger and
more complex... It takes a touch of genius -
and a lot of courage to move in the opposite
direction.                   -- Albert Einstein

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to