When I write
#!/usr/bin/perl -w
use strict;
while( ) {
print \"\\n-------------------------\\n\\n\";
print;
<>;
}
In your first script, with the $/ variable set to default "\n", the will only return one line at a time.
I believe the second script does what you want, it's just that <> won't terminate the read on a 'return' but rather on a
If you really want to regulate the output with 'return' then you need to do more with $/ in the loop.
while( ) {
print "\n-------------------------\n\n";
print;
$/ = "\n"; # default so that the following terminates the read on 'return'
<>;
$/ = "";
}