Allegakoen, Justin Devanandan wrote:

> ----------8<--------
> 
>>        # no warnings;
>>        next if $This =~ /\.pl$/;
> 
> 
> The above should be 'return' rather than 'next'.
> ----------8<--------
> Why didn't I think of that?
> 
> ----------8<--------
> Where is your description of the error ?
> ----------8<--------
> 
> I supplied the smallest failing sample code, but no output - ok;-
> 
> C:\Perl\Programs>perl
> use strict;
> use warnings;
> use File::Find;
> 
> find(\&Wanted, '.');
> 
> sub Wanted
> {
>         my $This = $File::Find::name;
> 
>         # no warnings;
>         next if $This =~ /\.pl$/;
> 
>         print  "FOUND: $This\n";
> }^D
> FOUND: .
> Exiting subroutine via next at - line 12.
> Exiting subroutine via next at - line 12.
> Exiting subroutine via next at - line 12.
> Exiting subroutine via next at - line 12.
> Exiting subroutine via next at - line 12.
> Exiting subroutine via next at - line 12.
> Exiting subroutine via next at - line 12.
> Exiting subroutine via next at - line 12.
> FOUND: ./Backup.pl~
> 
> return 0 if $This =~ /\.pl$/; gets rid of all that though. Thanks!
> 
> ----------8<--------
> 
>>Any tips?
> 
> 
> As to what ?  Where is a description of the problem ?
> ----------8<--------
> To the whole post.
> 
> ----------8<--------
> Are you aware of the 'defined' function for testing if a vrbl is defined
> ?
> ----------8<--------
> Yes. However when using the value from the DB directly I don't see any
> other option but to not use warnings:-
> 
> <SAMPLE DATA IN DB>
> MTEName       WW
>       10
>       
>       
>       
>       
>       
>       
>       
>       
>       
> </SAMPLE DATA IN DB>
> 
> <CODE WITH OUTPUT>
> use strict;
> use warnings;
> use Win32::ODBC;
> 
> my ($db, @Data);
> 
> unless($db = new Win32::ODBC("dsn=FLEX; UID=bill; PWD=issmart"))
> {
>         print "Error: " . Win32::ODBC::Error() . "\n";
>         exit;
> }
> 
> my $sql = "SELECT TOP 10 MTEName, YYYY FROM SBLDispo";
> 
> if($db->Sql($sql))
> {
>         print "Error, SQL failed: " . $db->Error() . "\n$sql\n";
>         $db->Close();
> }
> else
> {
>         #no warnings 'uninitialized';
> 
>         while($db->FetchRow())
>         {
>                 my %Temp = $db->DataHash();
> 
>                 foreach my $Key(keys %Temp)
>                 {
>                         push @Data, $Temp{$Key} if $Temp{$Key} =~ /^\w$/
> and defined $Temp{$Key};

Did you try testing for defined first ?  It evaluates left to right, not right 
to left.

                        if (defined $Temp{$Key} and $Temp{$Key} =~ /^\w$/) {
                                push @Data, $Temp{$Key};
                        }

>                 }
>         }
> }
> $db->Close();
> 
> foreach(@Data)
> {
>         print;
> }^D
> Use of uninitialized value in pattern match (m//) at - line 30.
> Use of uninitialized value in pattern match (m//) at - line 30.
> Use of uninitialized value in pattern match (m//) at - line 30.
> Use of uninitialized value in pattern match (m//) at - line 30.
> Use of uninitialized value in pattern match (m//) at - line 30.
> Use of uninitialized value in pattern match (m//) at - line 30.
> Use of uninitialized value in pattern match (m//) at - line 30.
> Use of uninitialized value in pattern match (m//) at - line 30.
> Use of uninitialized value in pattern match (m//) at - line 30.
> Use of uninitialized value in pattern match (m//) at - line 30.
> Use of uninitialized value in pattern match (m//) at - line 30.
> Use of uninitialized value in pattern match (m//) at - line 30.
> Use of uninitialized value in pattern match (m//) at - line 30.
> Use of uninitialized value in pattern match (m//) at - line 30.
> Use of uninitialized value in pattern match (m//) at - line 30.
> Use of uninitialized value in pattern match (m//) at - line 30.
> Use of uninitialized value in pattern match (m//) at - line 30.
> Use of uninitialized value in pattern match (m//) at - line 30.
> Use of uninitialized value in pattern match (m//) at - line 30.
> </CODE WITH OUTPUT>
> 
> The above example is the smallest set which reproduces what I'd like to
> avoid. I don't see how defined helps when I need to use $Temp{$Key}
> directly as with the regexp. Of course the SQL statement should be
> optimised, but again this is the smallest set of code that produces this
> output for valid conditions in my environment.


-- 
  ,-/-  __      _  _         $Bill Luebkert    Mailto:[EMAIL PROTECTED]
 (_/   /  )    // //       DBE Collectibles    Mailto:[EMAIL PROTECTED]
  / ) /--<  o // //      Castle of Medieval Myth & Magic http://www.todbe.com/
-/-' /___/_<_</_</_    http://dbecoll.tripod.com/ (My Perl/Lakers stuff)
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to