in reply to cat -ing Multiple files with Perl

sub catalanche { system qq( cat "$_" >> "$_[1]" ) for @{$_[0]}; } catalanche( \@sel_files => 'selected.txt' );
We're building the house of the future together.

Replies are listed 'Best First'.
Re^2: cat -ing Multiple files with Perl
by neversaint (Deacon) on Dec 14, 2005 at 07:05 UTC
    Dear jdporter,
    Is it possible to make your snippet above to print to STDOUT? I tried this modification in mycode.pl:
    catalanche( \@sel_files );
    and then do this with mycode.pl:
    $ perl mycode.pl > mydesired_outputfile.txt
    But it doesn't work. Hope to hear from you again.

    ---
    neversaint and everlastingly indebted.......
      Untested.
      sub catalanche { if ( @_ == 0 or $_[1] eq '-' ) # let - signify stdout as well { system qq( cat "$_" ) for @{$_[0]}; } else { system qq( cat "$_" >> "$_[1]" ) for @{$_[0]}; } }
      We're building the house of the future together.