Quoth "J. Gleixner" <glex_n...@qwest-spam-no.invalid>:
> On 11/01/12 15:43, Tuxedo wrote:
> > The below procedure, using lynx, simply dumps the source of a URL when
> > calling it with a single argument and prints each line:
> >
> > open(my $fh, '-|',
> > '/usr/bin/lynx','-source','-nonumbers','-cache=0','-nolist', $ARGV[0]) or
> > die $!;
> > while (my $line =<$fh>) {
> > print $line;
> > }
> >
> > Placed in a
lynx.pl file, it can be run as
> > ./
lynx.pl example.com
> >
> > Following the '-|' bit some fixed options are passed:
> > '/usr/bin/lynx','-source','-nonumbers','-cache=0','-nolist'
> > ... and thereafter the URL.
> >
> > How can this be better done in allowing arguments to be passed like:
> > ./
lynx.pl example.com -source -nonumbers -cache=0 -nolist
> >
> > ... then capturing the arguments somehow like follows:
> > open(my $fh, '-|', '/usr/bin/lynx', @flags $ARGV[0]) or die $!;
> >
> > In the end it's not much different from running lynx directly but I would
> > like some fixed and some optional arguments passed, and I'm not sure how to
> > construct and push additional arguments into a list, then copy the final
> > array into the file handle reading process between the -| bit and the
> > $ARGV[0] to allow for a flexible number of command line options.
>
>
No. What happens if I run