in reply to Another system redirect problem

It looks like you want something like this (UNTESTED):

# use File::Find; # open LIST_FH, '>>', '/Volumes/Expansion Drive/stuffTGZ/list_xxx_dirs.t +xt' or die "Cannot open '/Volumes/Expansion Drive/stuffTGZ/list_xxx_d +irs.txt' because: $!"; find( sub { return unless /\.xxx$/; print "$File::Find::name\n"; print LIST_FH "-------------------------------------------------"; print LIST_FH "- $File::Find::name -----------------------------"; open LS_PIPE, '-|', '/bin/ls' ,'-l', $File::Find::name or die "Can +not open pipe from '/bin/ls' because: $!"; print LIST_FH <LS_PIPE>; close LS_PIPE or warn $! ? "Error closing '/bin/ls' pipe: $!" : "Exit status $? from '/bin/ls'"; }, '.' );

Replies are listed 'Best First'.
Re^2: Another system redirect problem
by trendle (Novice) on Jun 18, 2011 at 21:40 UTC

    Almost there, a little mistake by copying my stuff over.

    open LS_PIPE, '-|', '/bin/ls' ,'-l', $File::Find::name or die "Cannot open pipe from '/bin/ls' because: $!";

    Becomes ...

    open LS_PIPE, '-|', '/bin/ls' ,'-l', $_ or die "Cannot open pipe from +'/bin/ls' because: $!";

    Because if the found directory is at a depth greater than 1 ls reports that it cannot find the path obtained by using $File::Find::name (this is because find (by default) cd's into each directory but $File::Find::name returns the path from the 'root' of the search). But $_ returns the found directory name only, (local to the current directory)