#! /usr/bin/perl -w use strict; my @letters = qw(a b c d e); #'a'..'e' also works, #but I didn't want to add #a red herring ;-) print ' $_ | $r | $.'."\n"; for (@letters) { if(my $r = /a/../e/) { printf "%4s |%4s |%4s\n", $_, $r, $.; } $.++; # ok, this is silly # but I'm making a point ;-) } print "\n", ' $_ | $r | $.'."\n"; while () { chomp; if(my $r = /a/../e/) { printf "%4s |%4s |%4s\n", $_, $r, $.; } } __DATA__ a b c d e