in reply to Re: cat -ing Multiple files with Perl
in thread cat -ing Multiple files with Perl

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.......

Replies are listed 'Best First'.
Re^3: cat -ing Multiple files with Perl
by jdporter (Paladin) on Dec 14, 2005 at 14:55 UTC
    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.