[Edinburgh-pm] Perl: run-time error

Nick Woolley nickwoolley at yahoo.co.uk
Thu Apr 5 03:10:00 PDT 2007


Hi,

Presumably the runtime errors you mean are these?

Use of uninitialized value in foreach loop entry at as.pl line 12, <> 
line 678.
Use of uninitialized value in foreach loop entry at as.pl line 12, <> 
line 678.
checking-
Argument "" isn't numeric in array element at as.pl line 14, <> line 678.
:: is missing

I think what you're trying to do is deref the first element of a the 
argument array @_, but:

  a) this would need an @ not a $, i.e. @{$_[0]}, not ${$_[0]}
  b) more to the point here, without the braces, $$_[0] becomes a 
symbolic reference to an array named by $_, which isn't set to an 
appropriate value.

Nick

--

nick at ramen:~/$ perl -d as.pl <as.data

main::(as.pl:4):    my %id=();

   DB<1> b 11
   DB<2> c
read line 2
[snip lots of printout]

main::check_missing_ids(as.pl:11):  my $val;
   DB<2> p $start

   DB<3> p $last

   DB<4> p $$_[0]

   DB<5> p @$_[0]

   DB<6> p @{$_[0]}
  1 10 100 1005 101 1012 102 103 103 [snip rest of array]

   DB<7> x $_
0  ARRAY(0x83f6e30)
      empty array

   DB<8> $_ = 'foo'

   DB<9> @foo = qw(a b c d)

   DB<10> p $$_[0]
a


More information about the Edinburgh-pm mailing list