"Charles K. Clarkson" <[EMAIL PROTECTED] To .net> <beginners@perl.org> cc 09/10/2005 01:39 AM Subject RE: Use of uninitialized value
Beast <mailto:[EMAIL PROTECTED]> wrote: : my $value = get_value_from_external_program; : : How do avoid such warning, because value is coming from : external program thus I can't make sure that it will : return a string or null. What do you want to do with $value when the external program does not return a value? One option is to supply a default value: my $value = get_value_from_external_program || 'default'; Or: my $value = get_value_from_external_program || ''; HTH, Charles K. Clarkson -- Mobile Homes Specialist 254 968-8328 *********************************************************** I have tried this and I am still getting a similiar error. Here is my perl-cgi code: my $which_import = $q->param('action') || ''; foreach my $scalar (@imports) { if ($which_import eq 'Import H9940') { while (<SAM>) { if (/(?ig)$scalar/) { my $ns=substr($_, 50); print $q->h3 ({-style=>'Color:#CC3300'},'Tape ID', $ns, 'is already in ASM.',"\n"); print $q->h3 ({-style=>'Color:#CC3300'},'Please Select a Different Tape ID.',"\n"); exit; } } close (SAM) or warn "Was unable to close FH at line 529 $!"; while (<SAM9>) { if (/(?ig)$scalar/) { my $nss=substr($_, 50); print $q->h3 ({-style=>'Color:#CC3300'},'Tape ID', $nss, 'was already exported from ASM.',"\n"); print $q->h3 ({-style=>'Color:#CC3300'},'Please Select a Different Tape ID.',"\n"); exit; } } close (SAM9) or warn "Was unable to close FH at line 541 $!"; $H99tapes{$scalar}++; sleep 1; print "\tNow Importing:\n"; system("import -v $scalar 900"); #or do &error($!); open (IMPORTLOG,">>/usr/local/log/import.log") or warn "Unable to open import log", &error($!); print IMPORTLOG "Tape:\t", $scalar, "\twas imported to ASM 800 db\t", $time,"\n"; close (IMPORTLOG) or warn "Unable to close import log", &error($!); } elsif (param('action') eq 'Delete H9940') { print "ASM H9940 Removed From Temporary Import List"; $H99tapes{$scalar}-- if $H99tapes{$scalar}; delete $H99tapes{$scalar} unless $H99tapes{$scalar}; } Derek B. Smith OhioHealth IT UNIX / TSM / EDM Teams 614-566-4145 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>