theorbtwo has asked for the wisdom of the Perl Monks concerning the following question:
sub out_pic_fullsize { my $basepath=shift; my $basename=shift; my $data=shift; my $html = $templ; print "out_pic_fullsize($basepath, $basename, $data)\n"; open HTML, ">$basepath/$basename.html"; $html =~ s/%%basepath%%/$basepath/g; $html =~ s/%%basename%%/$basename/g; $html =~ s/%%data%%/$data/g; print HTML $html; close HTML; }
Now, there's somthing really odd going on here. When you call this sub, it should make the file $basepath/$basename.html, and take the template and replace the %%foo%% with the crurrent value of $foo. This works for the %%basepath%% and %%basename%%, but NOT for %%data%% substitions, which end up being simply deleted.
It gets even wierder. If I replace the filename with $basepath/$basename$data.html, the substitions work fine.
The print before the open, however, always works.
Any ideas, guys?
Thanks,
-=- James Mastros
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: open() destroying my vars?
by redmist (Deacon) on Jul 29, 2000 at 06:08 UTC | |
by theorbtwo (Prior) on Jul 29, 2000 at 07:09 UTC | |
by redmist (Deacon) on Jul 29, 2000 at 09:15 UTC | |
by davorg (Chancellor) on Jul 30, 2000 at 15:48 UTC | |
by theorbtwo (Prior) on Jul 30, 2000 at 02:35 UTC | |
|
Re: open() destroying my vars?
by TQuid (Sexton) on Jul 29, 2000 at 21:07 UTC | |
by redmist (Deacon) on Jul 29, 2000 at 22:07 UTC | |
|
Re: open() destroying my vars?
by turnstep (Parson) on Jul 29, 2000 at 07:38 UTC | |
by theorbtwo (Prior) on Jul 30, 2000 at 01:07 UTC |