--- "Randal L. Schwartz" <[EMAIL PROTECTED]> wrote:> use
strict;
> my @stretch;
> while (<>) {
> my ($line, $val, $char) = split;
> if ($val < 1) {
> push @stretch, $char;
> }
> if ($val >= 1 or eof()) {
> if (@stretch >= 9) {
> printf "stretch%d-%d %s\n", $.-@stretch+1, $., join "",
> @stretch;
> }
> @stretch = ();
> }
> }
>
> I still don't like having to test $val twice. That's messy. It
> smells somehow. Can someone else figure out how to do it without
> duplicating any of the tests? I can't get enough state in the
> program counter. :)
Couldn't
> if ($val < 1) {
> push @stretch, $char;
> }
> if ($val >= 1 or eof()) {
be done to the same result with just
> if ($val < 1) {
> push @stretch, $char;
> } elsif (eof()) {
???
__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/