Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^3: How to swap rows with columns? - Still unresolved :(

by blazar (Canon)
on Oct 12, 2007 at 12:25 UTC ( #644455=note: print w/ replies, xml ) Need Help??


in reply to Re^2: How to swap rows with columns? - Still unresolved :(
in thread How to swap rows with columns? - Still unresolved :(

The script works fine if I use "./<script_name> data_file". But when I hardcode the name of data_file, it doesn't work. I am sure it has something to do with "while (<>)" statement. Can anyone please advice how to proceed when we have datafile name hardcoded, and it is read in an array and then.......???

I personally believe that you should get familiar with some basic Perl: then you wouldn't be asking such an embarassingly trivial question. Anyway, here's your fish - you either want

  • an explicit open as in:
    open my $fh, '<', $data_file or die "Can't open `$data_file': $!\n";
    and then you would use while (<$fh>) instead of while (<>), or
  • just populate @ARGV manually:
    @ARGV='data_file';


Comment on Re^3: How to swap rows with columns? - Still unresolved :(
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://644455]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (17)
As of 2015-07-06 13:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (75 votes), past polls