$_ = shift @data until /Amount/;       # start of transactions

> and get this warning:

Use of uninitialized value in pattern match (m//) at CMS2AP.pl line 138.

One way to avoid the warning is to check for that first uninit'ed $_
#!perl -w
use strict;
my @data = qw(hi ho hee ha Amount hoo hooh);
print "t: ", $_ = shift @data, "\n" until  ($_ and /Amount/);       # 
start of transactions
# $_ = shift @data until  ($_ and /Amount/);       # start of transactions

But if you've got a bunch of noise in there before 'Amount' you're wasting 
a lot of assigns, I think.  Similarly, you'll run for quite a ways if 
there *isn't* an "Amount" in there ;->

I tried to use the '...' flip-flop:
[the flip-flop '..' operator] can test the right operand and
       become false on the same evaluation it became true (as in awk), but 
it still returns true once.  If you
       don't want it to test the right operand till the next evaluation, 
as in sed, just use three dots ("...")
       instead of two.  In all other regards, "..." behaves just like ".." 
does.

but couldn't get it to help here. I'd think you'd want to do this on the 
front end, though.  Don't put it into @data in the first place
while (<>) {
 next if 1 .. /Amount/;
 chomp;
 push @data, $_;
...

or something.

a

Andy Bach
Systems Mangler
Internet: [EMAIL PROTECTED]
VOICE: (608) 261-5738  FAX 264-5932

The competent programmer is fully aware of the strictly limited size of
his own skull; therefore he approaches the programming task in full
humility, and among other things he avoids clever tricks like the
plague. -- Edsger Dijkstra
_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to