in reply to new line every match

Hi starface245,
from your code:

..... if ($line =~ /(address............)/) #13 dots for 13characters { my @values = split(' ', $line); foreach my $val (@values) { print "$val\n"; } ......
your foreach loop will only print out the following:
address 6433 main st address 6434 main st address 6435 main st
Thanks to the split function used to create array @values
Atleast, this is one of the many reasons, why you can't insist on your "ways" when asking for help.
However, If you must but have the same code structure, then I believe the script below could help:
#!/usr/bin/perl use warnings; use strict; my @values; while (<DATA>) { my ($line) = $_; chomp($line); if ( $line =~ m/^address/ ) { push @values, split( ' st ', $line ); } else { print $line, $/; } } print $_, ' st', $/ foreach @values; __DATA__ This is the list of address here are the addreses address 6433 main st address 6434 main st address 6435 main st
OUTPUT:
This is the list of address here are the addreses address 6433 main st address 6434 main st address 6435 main st