avi1991nash has asked for the wisdom of the Perl Monks concerning the following question:
Here I am converting all ".txt" file into".dat" from respective folder. But I am geting output ".txt.dat" instead of ".dat".
#!/usr/bin/perl $runDir = $ENV{"REGR_RUN_DIR"}; @files = (<*.txt>); foreach $FILE (@files) { open (IN, $FILE) || die "Couldn't open $FILE for reading"; open (OUT, ">$runDir/$FILE") || die "Couldn't open $FILE for reading"; while(<IN>) { print OUT $_; } } close(IN); close(OUT);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: conveting .txt file to .dat
by Corion (Patriarch) on Oct 24, 2016 at 17:15 UTC | |
|
Re: conveting .txt file to .dat
by ww (Archbishop) on Oct 24, 2016 at 17:50 UTC | |
by AnomalousMonk (Archbishop) on Oct 24, 2016 at 23:05 UTC | |
|
Re: conveting .txt file to .dat
by GotToBTru (Prior) on Oct 24, 2016 at 20:34 UTC |