On Fri, February 11, 2005 15:45, Brian Volk said: > Hi All, > > I'm having trouble w/ my script... I can open the dir, read the dir and even > get the s/// to work.... I just don't know how to write the new file to a > new dir. .... or the same dir for that matter... If someone could point > me > in the right direction I would really appreciate it. Maybe a page in the > Lama book... :~) > > #!/usr/local/bin/perl > > use strict; > use warnings; > > my $dir = "C:/brian/test_html"; > opendir (HTML, $dir) or die "Can't open $dir: $!"; > #my $newdir ="C:/brian/test_html_1"; > # opendir (HTML1, $newdir) or die "Can't open $newdir: $!"; > > # load @ARGV for <> operator below > > @ARGV = map { "$dir/$_" } grep { !/^\./ } readdir HTML; > > while (<>) { > chomp; > s/31990/31720/g; > print; > } > > > closedir (HTML); > > ___END > > > Brian Volk > HP Products > 317.298.9950 x1245 > <mailto:[EMAIL PROTECTED]> [EMAIL PROTECTED] > > > Brian, just a beginner myself, but i think the problem lies in your print going to STDIN by default. You must select the filehandle you want to print to before printing. Each print following this will print to that handle so it needs a further change if you want to print elsewhere after that also.
while (<>) { chomp; s/31990/31720/g; SELECT HTML1; print; } Chapter 11: Filehandles, in the Lama Book should help also. HTH -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>