in reply to Creating a tgz file without a module

I've found passing arguments to tar in a system command can be tedious, but this should work (tested)
#!/usr/bin/perl use warnings; use strict; my $dir = '.'; system ('tar', '-zcvf', 'my_tarball.tgz', $dir);
should do the tarr'ing and gunzipping in one step, packing up everything in $dir

I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku ................... flash japh

Replies are listed 'Best First'.
Re^2: Creating a tgz file without a module
by blue_cowdawg (Monsignor) on Sep 08, 2011 at 16:34 UTC

    FYI and FWIW, you can't count on tar recognizing the "-z" option on all flavors of *nix. I've been burned by this before and it depends on the "flavor" of tar installed on the system.


    Peter L. Berghold -- Unix Professional
    Peter -at- Berghold -dot- Net; AOL IM redcowdawg Yahoo IM: blue_cowdawg

      Thanks for the advice. Fortunately, this script will only be running on one system so, at least in this case, everything should be fine.