[Israel.pm] Double Array
Shlomo Yona
shlomo at cs.haifa.ac.il
Tue Feb 8 04:06:27 PST 2005
my @lines;
while(my $line=<>) {
chomp;
push @lines,[split(/;{4}/)];
}
# do your stuff with @lines;
# e.g.
# print $lines[0]->[2]; # prints c3 according to your
# example.
--
Shlomo Yona
shlomo at cs.haifa.ac.il
http://cs.haifa.ac.il/~shlomo/
On Tue, 8 Feb 2005, Georges EL OJAIMI wrote:
> I have a long file where in each line, 4 columns are separated by ";;;;"
>
> i.e.
> C1;;;;C2;;;;C3;;;;C4
> D1;;;;D2;;;;D3;;;;D4
> D5;;;;D6;;;;D7;;;;D8
> .
> .
> .
> .
> G1;;;;G2;;;;G3;;;;G4
>
> I have extracted the data but how can I list them in an array to be used
> later:
>
> @all = split(/\n/);
> foreach $line (@all) {
> @all1 = split(/;;;;/);
> foreach $line1 (@all1) {
> print $line1."\n";
> }
> }
>
> --
> BR
> Georges
>
>
> _______________________________________________
> Perl mailing list
> Perl at perl.org.il
> http://perl.org.il/mailman/listinfo/perl
>
More information about the Perl
mailing list