develooper Front page | perl.vmsperl | Postings from January 2002

Re: Confused about open/append failure

Thread Previous | Thread Next
From:
Craig A. Berry
Date:
January 31, 2002 21:24
Subject:
Re: Confused about open/append failure
Message ID:
a05101401b87fd5594860@[172.16.52.1]
At 9:02 PM -0700 1/31/02, Alan Winston - SSRL Central Computing wrote:
>VMS Perl people --
>
>I can open a file for append from DCL but can't open it from Perl. 

>$ perl
>open LOG, ">> $9$dka0:[reqs_log]reqs.log" or die "couldn't open it";
>^Z
>couldn't open it at - line 1.
>%RMS-F-SYN, file specification syntax error

The excessive number of dollar signs in all things DEC-related does
get one in trouble with Perl.  You have a double quoted string which
will do variable interpolation, so '$9' and '$dka0...' are
interpreted as variables.  You want to either escape the dollar signs
or put the filename into single quotes.  These may illustrate how
that works:

$ perl
print "$1$dua99";
 ^Z
$ perl
print "\$1\$dua99";
 ^Z
$1$dua99
$ perl
print '$1$dua99';
 ^Z
$1$dua99


>$ perl
>open LOG, "+>> $9$dka0:[reqs_log]reqs.log" or die "couldn't open it";
> Exit
>couldn't open it at - line 1.
>%RMS-F-SYN, file specification syntax error
>$
>
>Thanks for any insight.

-- 
____________________________________________
Craig A. Berry                  
mailto:craigberry@mac.com

"Literary critics usually know what they're
talking about. Even if they're wrong."
	-- Perl creator Larry Wall

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About