From: "Brad Cahoon" <[EMAIL PROTECTED]>
> I keep getting errors saying:
> 
> Use of uninitialized value in concatenation (.) or string at
> pagecreate.pl line 25.

Apparently one of the variables you use on that line is not 
initialized. Do you know which one?

> print() on closed filehandle FILE at pagecreate.pl line 29.

You did not check whether the open() succeeded, right?

> i have a script which calls a database and there are values in $ary[0] like:
> 
> bob smith
> joe
> susan / john
> larry jones / cary grant
> 
> and $ary[1] like:
> 
> friends
> enemys
> not sure
> 
> I am trying to put the details into directory/pages and have fallen
> down at the following code also i will try to put in underscores for
> names and directories once this bit works:
> 
> 
> while (@ary = $sth->fetchrow_array()){
> open FILE, ">c:\/\/output\/$ary[1]\/(
>               if ($ary[0] =~ m/\//) {($var1, $var2, $var3) = (split(/\s/,
> $ary[0]))$var1$ending}
>               else {$ary[0]$ending}";

Beg you pardon? First, ther is no need to escape forward slashes in 
quoted strings. You only have to do that inside regexps (is delimited 
by slashes) or if you use the quoting operators and use slashes as 
the delimiter.

Second you seem to want to evaluate some code inside a doublequoted 
string. While there are ways to do that you'd better do that outside. 
And store the generated name in a variable so that you can print it 
out in the error message you print if the open() fails. Which you did 
not test!

Third, there should be just one slash after the drive letter.


  my $file = "c:/output/$ary[1]/";
  if ($ary[0] =~ m/\//) {
    ($var1, $var2, $var3) = (split(/\s/, $ary[0]));
    $file .= $var1 . $ending;
  } else {
    $file .= $ary[0] . $ending;
  }

  open FILE, ">", $file or die "Failed to open '$file': $^E\n";

Jenda
===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
        -- Terry Pratchett in Sourcery


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to