in reply to text extraction question
Is the following something like what you're looking for...?
use strict; use warnings; use Data::Dumper; my $templateformat = 'w<NM>b<NM>cm<CH>sw<SW>'; my $inputexample = 'w8b8cm512swno'; my @first_array = ($templateformat =~ /<([^>]*)>/g); my @second_array = ($inputexample =~ /\d+/g); printf "First array = %s\n", Dumper(\@first_array); printf "Second array = %s\n", Dumper(\@second_arrayt); # Displays: # # First array = $VAR1 = [ # 'NM', # 'NM', # 'CH', # 'SW' # ]; # # Second array = $VAR1 = [ # '8', # '8', # '512' # ];
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: text extraction question
by johngg (Canon) on Dec 05, 2006 at 19:51 UTC | |
by liverpole (Monsignor) on Dec 05, 2006 at 19:58 UTC | |
by johngg (Canon) on Dec 05, 2006 at 20:34 UTC |