frenchcr has asked for the wisdom of the Perl Monks concerning the following question:
...when i try to print each command to its own file, ALL the commands go to ALL the files ?? I know ive messed up on the loops but confused where it went wrong and confused how to fix it. im a perl virgin, pls be kind.#!/usr/bin/perl -W $NumOfSim = shift(@ARGV); chomp($me = `id -un`); $PATH = "/home/$me/src/Tc/Scheme4/Simulation$NumOfSim"; open(FILEIN,"<$PATH/subfile") || die "Cannot open subfile\n"; @row_data = <FILEIN>; close FILEIN; for($j=0;$j<2968;$j++) # jmax = number of job subs { open(FILEOUT,">$PATH/subfile$j") || die "Cannot open subfile$j \n"; foreach $line(@row_data) { chomp($line); $cmd = "$line "; print FILEOUT "$cmd \n"; }#$line }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: loop da loop chomp chomp loop chomp blurp oops
by Erez (Priest) on Feb 02, 2008 at 16:25 UTC | |
|
Re: loop da loop chomp chomp loop chomp blurp oops
by lidden (Curate) on Feb 02, 2008 at 19:06 UTC | |
|
Re: loop da loop chomp chomp loop chomp blurp oops
by jwkrahn (Abbot) on Feb 02, 2008 at 19:35 UTC | |
|
Re: loop da loop chomp chomp loop chomp blurp oops
by toolic (Bishop) on Feb 02, 2008 at 19:21 UTC | |
by igelkott (Priest) on Feb 02, 2008 at 20:41 UTC | |
|
Re: loop da loop chomp chomp loop chomp blurp oops
by apl (Monsignor) on Feb 03, 2008 at 19:03 UTC | |
|
Re: loop da loop chomp chomp loop chomp blurp oops
by pc88mxer (Vicar) on Feb 03, 2008 at 19:37 UTC |