But is there a bit of perl code that would allow me to easily iterate over the scalar, line by line, as if it were a file?
Why would you want to do that? Besides you don't iterate over a file. You iterate over lists (or arrays). So you want to turn your scalar into an array with something like this ...
my $scalar_var = "1|2|3|4|5";
my @list = split /\|/, $scalar_var;
while( pop(@list) ) {
...
}
| Plankton: 1% Evil, 99% Hot Gas. |