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.
my $cmd = system("zcat -l /path/to/.gz/files"); print Dumper($cmd);
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.

I'd say all your suggestions are utterly rubbish and worthless.


In reply to Re^2: How would you do this? by JavaFan
in thread How would you do this? by david_lyon

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.