Rather than trying to create dynamically named arrays (which can be done but requires using things called symbolic references which are generally frowned upon unless there is a specific reason for their use) a hash of arrays seems like your best option here.
Some sample code to get you started. See perldata and perlreftut for further info.
#! perl -sw use strict; my %files; while(<DATA>) { chomp; my ($type, $ts) = m/(..)(.*)/; $files{$type} = [] if not exists $files{$type}; push @{$files{$type}}, $ts; } foreach my $type (keys %files) { print $type,$_,$/ for sort @{$files{$type}}; } __DATA__ vs010101.000 ud010101.000 ve020202.000 eq131302.000 eq010101.000 vs031102.000 us020101.000 ve051001.000
Gives output
c:\test>206767 eq010101.000 eq131302.000 us020101.000 ud010101.000 vs010101.000 vs031102.000 ve020202.000 ve051001.000 c:\test>
In reply to Re: dynamically named arrays
by BrowserUk
in thread dynamically named arrays
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |