in reply to RE: RE: Re: something about improving code...
in thread something about improving code...

Even more terse:
use strict; my ($START, $STOP) = qw(START STOP); while (<DATA>) { my $where = /$START/../$STOP/; print (($where and $where > 1 and $where !~ /E0/) ? "PRINTING\n" : " +not printing"); } __END__
--Chris

Updated: to use 'use strict;'. merlyns will work also with this. -w, however, makes both unhappy.

Replies are listed 'Best First'.
RE: RE: RE: RE: Re: something about improving code...
by merlyn (Sage) on Jun 28, 2000 at 03:57 UTC
    I didn't know we were golfing... :-)
    my ($START, $STOP) = qw(START STOP); while (<DATA>) { print (($where = /$START/../$STOP/ and $where !~ /^1$|E/) ? "PRINTIN +G" : "not printing"; }

    -- Randal L. Schwartz, Perl hacker

      Just because it's lying wide open... You've got a syntax error, ((close your parens :)

      And because I can't help this either... ( not simpler, just uglier... or is it? )

      my ($START, $STOP) = qw(START STOP); print( do {$_ = /$START/../$STOP/; $_ && $_ !~ /^1$|E/} ? "PRINTING\n" + : "not printing\n") while <DATA>;
      Enjoy!
      --
      Casey