in reply to reg exp
my $file = <STDIN>; chomp($file); if ($file =~ /\w+\.dat/) { open(DATOS, "$file") or die "error message"; while (<DATOS>) { push(@lines, $_) if /^\d/; } close DATOS; foreach my $line (@lines) { my @fields = split(/\s+/, $line); print "@fields"; # or whatever else you want to do } }
|
|---|