Hi,
I am new in Perl and need abit of help on the usage of file handler.
I was trying to write a line into a file with file handler ID "oFile2_$macro", but it does NOT work with the following Error :
String found where operator expected at /home/wongz/bin/pt/grab_clock_group.new.pl line 112, near "$macro "$_""
(Missing operator before "$_"?
############ START SNIPPET ###########
my $group = shift(@ARGV);
# Create files with filename from the argument array
foreach $macro (@ARGV) {
my $outfile ="$inFile"."_${group}_$macro";
print "Output file: $outfile \n";
open("oFile2_$macro", ">$outfile") or die "Can't open `$outfile': $!";
}
## Write a line into file with file handler name "oFile2_$macro"
## Error occured on the following line
## I tried by double-quoting the file handler like\\\\\\print "oFile2_$macro" "$_" ;\\\\\\\\ but it still does NOT work.
print [B]oFile2_$macro [/B]"$_" ;
############ END SNIPPET ###########
Does anyone know the correct way to set the file handler name ?
Thanks