Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Hi, Im trying to have all numeric values from a sting and join them with pipe string is
EEH_ErrorCode=( 15, /* Component */ 65 /* Error */) and my output should be 15|65
while ($flag == 0 ){ if ($str =~ m/\)/ ) { $flag = 1; } else{ my @array=split(/' '/,$str); if(defined $array[0] ){ $array[0] =~ s/[^0-9]//g}else{$array[0] +=''}; if(defined $array[1] ){ $array[1] =~ s/[^0-9]//g}else{$array[1] +=''}; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: find all numeric values from a string and join them
by hippo (Archbishop) on May 18, 2018 at 10:10 UTC | |
|
Re: find all numeric values from a string and join them
by AnomalousMonk (Archbishop) on May 18, 2018 at 13:19 UTC | |
by davido (Cardinal) on May 18, 2018 at 16:09 UTC | |
|
Re: find all numeric values from a string and join them
by james28909 (Deacon) on May 19, 2018 at 16:37 UTC |