[H-GEN] fscking perl

James Mcpherson j.mcpherson at mailbox.uq.edu.au
Wed Sep 2 23:02:39 EDT 1998


On Thu, 3 Sep 1998, Paul Gearon wrote:
> From: Paul Gearon <pag at tams.com.au>
[Nikolai]
> > > print $Name "\n";
> > > print $Value "\n";
> > > 
> > 
[Brad]
> > Which is expected behaviour from your script - what yo're 
> > doing is trying
> > to print to filehandles $Name and $Value - try adding a . between the
> > variable and the \n, so the lines look something like:
> > 
> > print $name . "\n";
> > print $value . "\n";
> > 
> Alternatively, put the variables in your string:
> print "$Name\n";
> print "$Value\n";
> 

<begin mode="teaching relative to suck eggs">
Aren't we missing the issue here? the error messages are:

> File handle main::Van Morrison never opened at ./insert.pm line 67.

this one means that your script is unable to open a filehandle with the
name "Van Morrison" - it's got a space character in it. You need to go
through the script and check exactly _what_ it is trying to open  - looks 
to me like $ARGV[2]. Then you need to pass the appropriate args to the
script - that might make it work the way the author intended.


> Can't use an undefined value as a symbol reference at ./insert.pm line 68.

You are obviously running with the "-w" command line option -- turns on
warnings. You might also find a line saying "use strict;" somewhere near
the top of the script. To solve that, find the context in which the vars
are operating (ie, is it in a sub or block or anonymous whatsisname?)
and then _in_ that context, declare it!

eg: if they are global vars, up the top of your script you can declare them
as the following:

my ($Name, $Value) = undef;

you can even leave off the "= undef" bit it you want since that part at
least is merely up to personal style.

then of course, check just what those vars are supposed to contain.

</end{teaching relative to suck eggs}>

cheers,
James

-- 
 I do not speak for the University of Queensland or the University Library
J.McPherson at mailbox.uq.edu..au   | this space _not_ for rent. 
j.mcpherson at library.uq.edu..au   | remove erroneous char to reply properly





More information about the General mailing list