Is there an easy way to read <STDIN> into a stack until some pattern is
matched and then break. I tried all sorts of (error producing) code,
but nothing seemed to work. I ended up with:
#! /usr/bin/perl
#can I make this more concise?
$infinite_loop = 1;
while ($infinite_loop)
{
$temp = <STDIN>;
if ($temp =~ /QUIT/)
{
$infinite_loop = 0;
continue;
}
push @thestack, $temp;
}
I've got a funny feeling that perl will let me make the above 15 lines
of code /much/ more concise. How can I do this?
Is there any way to do something like?
while (1)
{
push @thestack, <STDIN> unless <STDIN> =~ /QUIT/;
last if <STDIN> =~ continue;
}
Or perhaps something even more concise (and much more perlish)?
Thanks,
Dan
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]