freelanceprogrammers.org Forum Index » Perl
variables not initialized
Joined: 11 Aug 2004
Posts: 1
variables not initialized
hi all
I`m newbie on perl, I wanna ask something.
I have code to read the content of a file like this:
sub test {
my @sections=@_;
my $filename=pop @sections;
my @ret;
my $cnt=0;
my $tag;
my $starttag;
my $endtag;
open (FTPL,$filename) or die "Can not open file
"$filename"
";
$tag=shift @sections;
$starttag="{".$tag."}";
$endtag="{/".$tag."}";
while(<FTPL>) {
if (/$starttag/) {
$_=<FTPL>;
until (/$endtag/) {
$ret[$cnt].=$_;
$_=<FTPL>;
}
}
$tag=shift @sections; <---this variable have problem
$starttag="{".$tag."}";
$endtag="{/".$tag."}";
$cnt++;
}
@ret;
}
from that code, i got a warning :
Use of uninitialized value in concatenation (.) or string at
include/misc_function.pl line 44, <FTPL>
My code running well, but i don`t like the warning.
Is anyone can give me a clue?
thanx before.
All times are GMT
Page 1 of 1
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Freelace Website Designer - Customer web design and software building.
China Wholesale - Electronics Products
Character Studio - Tutorials and Help
China Wholesale - Electronics Products
Character Studio - Tutorials and Help







