in reply to Re: How would you do this?
in thread How would you do this?
First, you didn't declare $cmd. That should be my $cmd = .Uhm, no. This is Perl, remember. You don't have to declare anything. Besides, the OP was showing a code snippet. He might as well have your precious "my $cmd" somewhere in the code he (rightfully so) did not post.
Second, "zcat *gz": What do you want it to do? Did you have an option in mind? More information there would be helpful.First, you misquote. It's zcat *.gz. Second, it's quite obvious that he wants to run zcat on all the gzipped files in the current directory. No need to further explain that.
Third, since you're running system commands, you'll need to use perl's "system" command.That's neither correct, nor is your remark useful. system is not the only way to run external commands (backticks, exec and open do as well), but the OP is using system.
The print command would come after that.Really? The OP is just printing the command to be executed. There's no need to first execute the command, than to print it.
Now, that's a program that does little useful. Unlike the code of the OP that actually does something with the content of the uncompressed file - yours just dumps it to the screen. And then you use Data::Dumper to print out the value of an integer.my $cmd = system("zcat -l /path/to/.gz/files"); print Dumper($cmd);
I'd say all your suggestions are utterly rubbish and worthless.
|
|---|