Hi again,

As you know, I am trying to insert a string at the beginning of a file
without overwriting its contents. Since my file is an HP/GL2 output
file, I put every hp/gl2 command and stack them into an array. I then
truncate the file, insert my specific string, and then put back all the
commands after that string :

open (FILE, "+>>$ARGV[0]") or die ("Can`t open file! : $!\n");

# We put contents of the file in a temporary scalar
my $in = <FILE>;

# Clear the file
truncate (FILE,0) or die ("Can't truncate file! : $! \n");


# Build the string to insert at the beginning
my $jobname = $ARGV[1];         #ARGV[0] is the file to be modified
my $pjl = '@PJL JOB NAME = "' . $jobname . '"' . '\n'; # What a dumb way
to build the string, any better ideas?
printf FILE "\e%-12345X ";
print $pjl;


As you can see, I wasn't able to build the string like this :
printf FILE "\e%-12345X @PJL JOB NAME = $ARGV[1] \n";

Because between double quotes the @ of @PJL will be interpolated, which
I don't want.

When running the script I get this error :
Use of uninitialized value in printf at ./hptable.pl line 126, <FILE>
line 1.
line 126 = printf FILE "\e%-12345X ";


I'd like first to know a better way to build the string (avoiding the @
interpolation).

Then I'd like to know why I get that error when printing the string in
the file.

Thanks!

Best regards,

Steve Hemond
Programmeur Analyste / Analyst Programmer
Smurfit-Stone, Ressources Forestieres
La Tuque, P.Q.
Tel.: (819) 676-8100 X2833
[EMAIL PROTECTED] 


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


Reply via email to