use strict; use warnings; while (my $line = ) { if ($line =~ /^id:\d+/) { for (1 .. 4) { my $following = ; print $following; } } } #### __END__ John, Doe Michael id:1234567890123 library:ACME City, state:PUEBLO, CO Phone:719-555-555 Street:1610 Sorrow AVE APT D Zip: 81004 Shakespeare, William id:4567890123999 library:Fisher Fine Arts Library City, state:Philadelphia, PA Phone:215-898-8325 Street:Locust Zip: 19104 #### City, state:PUEBLO, CO Phone:719-555-555 Street:1610 Sorrow AVE APT D Zip: 81004 City, state:Philadelphia, PA Phone:215-898-8325 Street:Locust Zip: 19104