![]() |
|
Perl-Sensitive Sunglasses | |
PerlMonks |
Re: Printing Columns from Two Different Filesby boo_radley (Parson) |
on Jan 31, 2003 at 16:59 UTC ( #231661=note: print w/replies, xml ) | Need Help?? |
you've got a bunch of the pieces put together correctly, but there's a few areas where these individual bits don't mesh together right. You're reading two files (the while (<INFILE>) and while (<INFILE2>)), but you're not storing the results of those reads. In fact each run through the loop overwrites the information that was there previously. You might declare arrays outside of these loops and store the results of the splitting in them, so that you preserve the work you're doing. You don't seem to use $mask, $x, $y, $dfront, $ftdens, $depth, $slope, $tuna, $temp or $sptr in any useful fashion; is this part of a larger script? If not, you might consider dropping them entirely because they're not doing you any good. It may also benefit you to drop the the chdirs and simply open the files with :
Finally, the diamond operator doesn't do what I expect you expect it does. It runs through @ARGV (which itself gets populated with the script's) command line arguments, treating each element as a filename which gets opened, and read line by line. Since no arguments were specified, it's waiting for input on STDIN ("just hangs"). As a rough, untested outline, here's my take on the problem. It's not fully fleshed out, but it provides a quick idea of what a solution might look like.
In Section
Seekers of Perl Wisdom
|
|