in reply to parsing a file

tcf03,
Your question was a little confusing to me so please forgive me if this solution doesn't do what you want. You said that the file is in the format of not having the __BEGIN__/__END__ blocks, so presumably you want to add them. You also want to process each users information before adding them. Something like the following should work
#!/usr/bin/perl use strict; use warnings; { local $/ = ""; # paragraph mode while ( <DATA> ) { chomp; process_user( $_ ); print "__BEGIN__\n$_\n__END__\n"; } } sub process_user { my @lines = split /\n/, shift(); for ( @lines ) { # do something with line; print "$_\n"; } } __DATA__ USER 1 LOGIN date MORE info MORE info USER 2 LOGIN date MORE info MORE info USER3 LOGIN data MORE info MORE info

Cheers - L~R