print "This is the list of address\n", "here are the addresses\n"; while () { my($line) =$_; chomp($line); while ($line =~ /(address............)/g ) { my @values = split(' ', $line); foreach my $val (@values) { next; print "$val\n"; } print "$1\n"; } }