Possible in a way?

OF course yes! That's why I asked about calling semantics. Which part is gathering the collection of files to iterate over? the shell script? do you want perl to gather the files? what system are you on?

<handwaving style="amount: lots"> If you are gathering the file via a shell script, you could do something along these lines

( while read command param; do # whatever method files=`command param` # to gather the files for file in $files; do # process files echo $file done done) | maincode.pl

and in maincode.pl

#!/usr/bin/perl use IPC::Open2; my $cmd = 'whatever'; # really, I have no idea what you are doing $pid = open2(\*CHLD_OUT, \*CHLD_IN, $cmd) or die "oops: $!\n"; while(<STDIN>) { chomp; my $file = $_; # now do whatever with $file. open(I,'<', $file); while (my $line = <I>) { ... # do whatever with each line in the file } }

but since I still don't know what you're up to, I can't give proper advice. See I know what I mean. Why don't you?

Maybe you really want some client/server stuff, or the perl code to act as a stream filter, and dispatch it's output to somewhere else. Each usage has different semantics; how can I know which are required, without a bit more of explanation from you?

--shmem

_($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                              /\_¯/(q    /
----------------------------  \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}

In reply to Re^3: batch processing via single open by shmem
in thread batch processing via single open by karden

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.