use strict; use warnings; use Readonly; # Assume input file name on command line (default is 'phones.txt). Readonly::Scalar my $PHONE_FILE => $ARGV[0] || 'phones.txt'; Readonly::Array my @COLOURS => ; # Assume columns seperated by tabs, all other whitespace is significant. Readonly::Scalar my $GET_MODEL => qr{\A ( [^\t]+ ) }x; open my $PHONES, '<', $PHONE_FILE or die "Cannot open $PHONE_FILE\n"; while (my ($phn) = <$PHONES> =~ $GET_MODEL) { foreach my $colr (@COLOURS) { print "\n$phn $colr"; } print "\n==="; } close $PHONES __DATA__ baby blue baby pink black dark blue brown dark purple green orange hot pink light purple red white yellow