in reply to UNIX shell commands in Windows

One of the raisons d'etre of perl is precisely to create a programming environment where shell commands can as far as possible be avoided in favour of the rich portable facilities perl offers. Okay, so it's one line in the shell or DOS. However, you could do a search and replace e.g. with perl -e to convert `cat x > y` into Cat( x,y ) so as to use something portable like:-
sub Cat{ local $/=undef(); open my $fh, "<" . shift(); open my $gh, ">" . shift(); $_=<$fh>; print $gh $_; close $fh, $gh; }

-S

Replies are listed 'Best First'.
Re^2: UNIX shell commands in Windows
by derby (Abbot) on Jun 23, 2005 at 16:37 UTC

    The best reply to the OP but I wouldn't slurp the file up all at once (who knows how big it would be).

    Duh! use File::Copy.

    -derby
      How is it better than File::Copy? It slurps the entire file into memory, doesn't check for errors and doesn't handle non-text files.

        Damn ... I didn't realize File::Copy was core. I'm getting too old and forgetting a lot of what I never even knew. ++ikegami, --derby.

        -derby