"Kipp, James" wrote:
> >
> > # INPUTDATA is the filehandle through which you are getting the input
> > while (<INPUTDATA>) {
> > chomp;
> > s/^\s+//;
> > next if (m/^$/ || (1 .. /^NPROC/));
>
> >what does the range thing do?
> >wouldn't just ... || /^NPROC/ be enough?
>
> I think that is how he eliminates lines up to the NPROC line. so in other
> words, next if range from line 1 to /^NPROC/. and it does work.
Yes that is right, I also have to point out a potential problem here
This will not work if the first line is empty, why?
The condition 1../^NPROC/ is triggered on only when the left operand
becomes true, in this case line number 1 (.. in scalar context compares
a constant operand (if provided) to $.). If the first line is empty the /^$/
will swallow it up and the range check will never be triggered.
The fix would be to swap the conditions around to
next if ((1../^NPROC/) || m/^$/);
Also seems more intutive, ignore all lines until you see a /^NPROC/
and do the rest after that
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]