Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Array problem......PLEASE HELP!

by zentara (Archbishop)
on Jan 05, 2009 at 21:01 UTC ( [id://734279]=note: print w/replies, xml ) Need Help??


in reply to Array problem......PLEASE HELP!

Maybe this will shed some light:
#!/usr/bin/perl use warnings; use strict; opendir(DIR, '.'); my @files = grep !/^\.{1,2}$/, readdir DIR; #no . or .. @files = grep /08|09/, @files; #only 08 09 files closedir DIR; print "@files\n"; my @commands; foreach my $file (@files){ my $string = `ls -l|grep $file`; push @commands, [$file, $string]; # push arrayref } print join "\n", @commands,"\n"; foreach my $arrayref( @commands){ print $arrayref->[0]. "\t=\t". $arrayref->[1],"\n"; }

I'm not really a human, but I play one on earth Remember How Lucky You Are

Replies are listed 'Best First'.
Re^2: Array problem......PLEASE HELP!
by green_lakers (Novice) on Jan 05, 2009 at 22:02 UTC
    Hi there, I have updated some things in my question? can you please help?
      First of all, I have no idea what you are trying to do. If you are running a second Perl script, thru system, you are going about it wrong. Why not combine all operations into one script?

      The problem we are all having, is that your question dosn't seem to make sense; and it's hard for experienced programmers to warp their minds into fixing some sort of Rube Goldberg code contraption.

      What you should do, is show what is in those files, even if just a few sample lines. Then say what you want to do with the files and data...like what output do you expect?

      Once we have a clear idea of what you need to do to the files, and what they contain, we can give you a good answer. Otherwise, we are just trying to figure WHY you are doing it your way? Finally, use warnings, and strict. Many problems, like yours are caused by global variables acting unexpectedly, and it shows good faith on your part, to use warnings and strict.


      I'm not really a human, but I play one on earth Remember How Lucky You Are

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (5)
As of 2024-04-23 07:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found