----- Original Message ----- 
From: "John" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Saturday, May 26, 2007 7:50 PM
Subject: What is not initialised here?


>I use this to churn through unwanted data:
>
>    $_ = shift @data until /Amount/;       # start of transactions
>
> and get this warning:
>
> Use of uninitialized value in pattern match (m//) at CMS2AP.pl line 138.
>
> The message is only reported once. The statement becomes true on line 45
> of my current test data.
>
> Could someone please explain to me what is not initialised.
>

$_ itself is initially uninitialized:

---------------------------
use warnings;

@data = ('a', 'b', 'Amount', 'c', 'd');

$_ = "hello world";

$_ = shift @data until /Amount/;
---------------------------

You won't get the warning with that script - but if you comment out the line
that assigns "hello world" to $_, then you will get that warning.

I think the "until /Amount/" part tests to see whether $_ matches Amount,
but the very first time the match is tested $_ is uninitialized (unless
something has already been assigned to $_).

Cheers,
Rob

_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to