#!usr/bin/perl -w use strict; my @matrix; while (<DATA>) { chomp; my @numbers = split; #default variable to split upon is $_ #default split is on spaces next unless @numbers; #skip blank lines (no characters) push (@matrix, \@numbers); #An array of array } foreach my $array_ref (@matrix) { print "@$array_ref\n"; } =Output 5 5.1 62.1 6 6.1 6.7 =cut __DATA__ 5 5.1 62.1 6 6.1 6.7
In reply to Re: Explaining small Code
by Marshall
in thread Explaining small Code
by madM
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |