examples/arrays/pop_push.pl
#!/usr/bin/perl
use strict;
use warnings;

my @names = ("Foo", "Bar", "Baz");

my $last_name = pop @names;

print "$last_name\n";        # Baz
print "@names\n";            # Foo Bar


push @names, "Moo";

print "@names\n";            # Foo Bar Moo
examples/arrays/data.txt
1
27
-13
2
examples/arrays/collecting_data.pl
use strict;
use warnings;

my $file = 'data.txt';

my @positive;
open my $fh, '<', $file or die "Could not open $file : $!";
while (my $line = <$fh>) {
   if ($line > 0) {
     push @positive, $line;
   }
}
print @positive;