On Sun, Jul 29, 2012 at 10:01 AM, lina <lina.lastn...@gmail.com> wrote: > Strangely, it only substituted once, but not for the later once. > Thanks ahead for your suggestions, I don't know why,
Not exactly sure what you're up to - but you only open fh1 once - so the inner while in your sub is going to read until eof and close. The 2nd call to <$fh1> will be undef and not loop. You may want to open $fh1 inside the sub but that's ... at some point you may want to look at opening fh1 once and putting the data into some structure/string and then doing your work on that (or, as it's a template, some copy) w/ the data. Note, you really want to look at verifying your opens: open my $fh1, '<', $template_file or die "can't open $template_file: $!"; as this would also be troublesome for your code flow and it's just a good idea. -- a Andy Bach, afb...@gmail.com 608 658-1890 cell 608 261-5738 wk -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/