Hi,
I need to create five files . So I store five values in array.Those value are my file handler and file name
use strict; my $start='<?xml version="1.0" encoding="utf-8"?> <MultifamilyProperty xmlns:xsi="http://www.w3.org/2001/XMLSchema-insta +nce" xmlns:xsd="http://www.w3.org/2001/XMLSchema">'; my @key=("1","2","3","4","5"); my ($file_handle,$output_file); $output_file=".xml"; for(my $i=0;$i<$#key;$i++) { my $val=$key[$i]; $file_handle=$val; $output_file=$val.$output_file; open($file_handle,'>:utf8',"$output_file"); print $file_handle $start."\n"; print $file_handle "\t\t".'<Address>'."\n"; close $file_handle; }
If i comment Use Strict line .My program is running and five files is created but Without commenting Use Strict i got error like
Can't use string ("1") as a symbol ref while "strict refs" in use at D +:\senthil\ xmlgeneration\xmltest\file.pl line 12.
Regards,
Senthil
In reply to Error coming while using Use Strict by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |