in reply to Last Character into Array

use strict; use warnings; my $file = 'foo.txt'; open my $fh, $file or die "$file: $!"; my @array; while (<$fh>) { push @array, $1 if /(\d+)$/; } close $fh; print "@array\n";

Replies are listed 'Best First'.
Re^2: Last Character into Array
by anonymized user 468275 (Curate) on Apr 26, 2011 at 13:08 UTC
    The first digits if found in the first field would get transferred into the array instead of the second field. oops just noticed the "$" in the regexp

    One world, one people