[10128] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 3721 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Sep 15 16:07:18 1998

Date: Tue, 15 Sep 98 13:00:16 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 15 Sep 1998     Volume: 8 Number: 3721

Today's topics:
    Re: assigning file contents to a string <jason.holland@dial.pipex.com>
    Re: assigning file contents to a string <J.D.Gilbey@qmw.ac.uk>
        Can I foreach multiple arrays? (Joachim Zobel)
    Re: getting number of elements in multiple dimensions (Larry Rosler)
    Re: getting number of elements in multiple dimensions (Bob Trieger)
        Help: "cat" command and variable assignment avern@hotmail.com
    Re: Help: "cat" command and variable assignment <J.D.Gilbey@qmw.ac.uk>
        how to handle compressed text files adrs@chemistry.ucsc.edu
    Re: how to handle compressed text files <J.D.Gilbey@qmw.ac.uk>
    Re: How to pass perl script's STDIN to Korn shell's ARG (Matt Knecht)
    Re: Perl & Java - differences and uses (Cees de Groot)
    Re: Perl & Java - differences and uses (Abigail)
    Re: Perl & Java - differences and uses <zenin@bawdycaste.org>
    Re: Perl & Java - differences and uses <zenin@bawdycaste.org>
    Re: Perl & Java - differences and uses <borg@imaginary.com>
    Re: Perl & Java - differences and uses (Abigail)
    Re: Perl & Java - differences and uses <mtr@igs.net>
        Perl Question for Unix gurus (MercuryZ)
    Re: Perl Question for Unix gurus (Michael Fuhr)
    Re: Perl Question for Unix gurus (Greg Bacon)
    Re: print statement in perl <jeffp@crusoe.net>
    Re: Who posts original posts on CLPM? (Michael J Gebis)
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Tue, 15 Sep 1998 20:04:13 +0000
From: Jason Holland <jason.holland@dial.pipex.com>
To: avern@hotmail.com
Subject: Re: assigning file contents to a string
Message-Id: <35FEC83D.8A992CC5@dial.pipex.com>

avern@hotmail.com wrote:
> 
> I know this is a very newbie-ish question, but I've already checked the FAQ.
> Does any know a very concise way (say, 1 line) to assign the contents of a
> file to a string variable? I've seen instructions on processing a file
> line-by-line or paragraph-by-paragraph, but I don't want to manipulate the
> file contents in any way.  I just want to store the entire file in a
> variable, so that I can later refer to the variable in a print statement.
> Can this be done without creating a sub-procedure?

Try this:

	open( FILE, "file" );
	my $content = "" ; foreach ( <FILE> ) { $content .= $_ }
	close( FILE );

Bye!

-- 
sub jasonHolland {
    my %hash = ( website =>
'http://dspace.dial.pipex.com/jason.holland/',
                 email   => 'jason.holland@dial.pipex.com' );
}


------------------------------

Date: Tue, 15 Sep 1998 20:31:34 +0100
From: Julian Gilbey <J.D.Gilbey@qmw.ac.uk>
Subject: Re: assigning file contents to a string
Message-Id: <35FEC096.4910E034@qmw.ac.uk>

Matt Knecht wrote:
> 
> avern@hotmail.com <avern@hotmail.com> wrote:
> >Does any know a very concise way (say, 1 line) to assign the contents of a
> >file to a string variable?
> 
> Well, It's s stretch to get it on one line, but this should be the
> quickest way:
> 
> { local $/; $file_contents = <FILE>; }

Which works, because the file is input in `lines', where the line
delimiter is given by the value of the $/ variable.  This is normally
"\n", so the file is read in lines.  If it is set to "", then the file
is read in paragraphs, and if it is unset, then the whole file is
slurped in one go.

   Julian

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

            Julian Gilbey             Email: J.D.Gilbey@qmw.ac.uk
       Dept of Mathematical Sciences, Queen Mary & Westfield College,
                  Mile End Road, London E1 4NS, ENGLAND
      -*- Finger jdg@goedel.maths.qmw.ac.uk for my PGP public key. -*-


------------------------------

Date: Tue, 15 Sep 1998 19:52:53 GMT
From: jzobel@my-dejanews.com (Joachim Zobel)
Subject: Can I foreach multiple arrays?
Message-Id: <35fec571.1428841@dilbert.crrrwg.de>


Hi.

I would like to

foreach ($foo, $bar) (@foos, Qbars) {} # doesn`t work

just like I 

foreach $foo (@foos) {}

Is there a simple and elegant way?

Thanx,
Joachim

"I read the news today oh boy"             - The Beatles - A Day In The Life

Also this message has a valid From header, replies 
to user@kud.com where user = jzobel are preferred.


------------------------------

Date: Tue, 15 Sep 1998 11:00:43 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: getting number of elements in multiple dimensions
Message-Id: <MPG.10684b29e8664b7598985a@nntp.hpl.hp.com>

[Posted to comp.lang.perl.misc and copy mailed.]

In article <sariuip8eum.fsf@camel.fastserv.com> on 15 Sep 1998 13:28:49 -
0400, Uri Guttman <uri@camel.fastserv.com> says...
> >>>>> "LR" == Larry Rosler <lr@hpl.hp.com> writes:
>   >> For example: $stuff[4][5] = "dog";
>   >> 
>   >> how would you return "5" if that was the last element in the array?
> 
>   LR> Amazing -- identical question twice in one day.
> 
>   LR> $#{$stuff[4]}
> 
> that's whay they call them FAQ!
> 
> :-)

True only for certain values of 'Frequently'.  A quick look at DejaNews 
implies that this question was last asked here on April 10.  And it 
certainly doesn't appear in 'the' FAQ.  Yet here it is twice in one day.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


------------------------------

Date: Tue, 15 Sep 1998 18:42:23 GMT
From: sowmaster@juicepigs.com (Bob Trieger)
Subject: Re: getting number of elements in multiple dimensions
Message-Id: <6tmce3$v2b$4@strato.ultra.net>

[ posted to usenet and courtesy e-mail sent ]
lr@hpl.hp.com (Larry Rosler) wrote:
-> [Posted to comp.lang.perl.misc and copy mailed.]
-> 
-> In article <sariuip8eum.fsf@camel.fastserv.com> on 15 Sep 1998 13:28:49 -
-> 0400, Uri Guttman <uri@camel.fastserv.com> says...
-> > >>>>> "LR" == Larry Rosler <lr@hpl.hp.com> writes:
-> >   >> For example: $stuff[4][5] = "dog";
-> >   >> 
-> >   >> how would you return "5" if that was the last element in the array?
-> > 
-> >   LR> Amazing -- identical question twice in one day.
-> > 
-> >   LR> $#{$stuff[4]}
-> > 
-> > that's whay they call them FAQ!
-> > 
-> > :-)
-> 
-> True only for certain values of 'Frequently'.  A quick look at DejaNews 
-> implies that this question was last asked here on April 10.  And it 
-> certainly doesn't appear in 'the' FAQ.  Yet here it is twice in one day.

Both original posters may be in the same class and you just did their 
homework for them.


Bob Trieger              | `Sparks International' is spamming and 
sowmaster@juicepigs.com  | trying to help us lose weight. Let's do 
                           them a favor. Call to let the know that
                           spamming is evil and do it on their dime.

                           Call 1-888-689-3097


------------------------------

Date: Tue, 15 Sep 1998 18:05:27 GMT
From: avern@hotmail.com
Subject: Help: "cat" command and variable assignment
Message-Id: <6tma96$fvk$1@nnrp1.dejanews.com>

Hi,

This is a clarification of my earlier post.  Is it possible to write a single
line in perl that assign the contents of a file to a string variable by
piping the output of a "cat" command? Does anyone know the correct syntax? 
I'm looking for something like:

$entire_file =  " cat path/to/file | ";

OR

$entire_file = " `cat path/to/file`";  (note the backticks versus the pipe)

I haven't tried either of the above out yet because I don't have perl where I
am right now, but I appreciate if anyone could tell me if either of those
would work.

Thanks again!
Avern

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


------------------------------

Date: Tue, 15 Sep 1998 20:38:24 +0100
From: Julian Gilbey <J.D.Gilbey@qmw.ac.uk>
Subject: Re: Help: "cat" command and variable assignment
Message-Id: <35FEC230.7B4D2BFD@qmw.ac.uk>

avern@hotmail.com wrote:
> 
> Hi,
> 
> This is a clarification of my earlier post.  Is it possible to write a single
> line in perl that assign the contents of a file to a string variable by
> piping the output of a "cat" command? Does anyone know the correct syntax?
> I'm looking for something like:
> 
> $entire_file =  " cat path/to/file | ";
> 
> OR
> 
> $entire_file = " `cat path/to/file`";  (note the backticks versus the pipe)

Firstly, why would you want to do such a thing when Perl can open the
file itself directly, instead of spawning another process to simply
do the same?

But if you must use cat, then you should do one of the following:

unless (open CATOUT, "cat /path/to/file |") { die "Couldn't open!": }
{ local $/; $entire_file = <CATOUT>; }

or

$entire_file = `cat /path/to/file`;

Note that backticks are NOT interpolated inside of double quotes in
Perl.

HTH,

   Julian

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

            Julian Gilbey             Email: J.D.Gilbey@qmw.ac.uk
       Dept of Mathematical Sciences, Queen Mary & Westfield College,
                  Mile End Road, London E1 4NS, ENGLAND
      -*- Finger jdg@goedel.maths.qmw.ac.uk for my PGP public key. -*-


------------------------------

Date: 15 Sep 1998 19:19:03 GMT
From: adrs@chemistry.ucsc.edu
Subject: how to handle compressed text files
Message-Id: <6tmej7$7qk@darkstar.ucsc.edu>

What is a good way to handle compressed files?  I have several text files
I'd like to parse, each of which has been compressed with Unix 'compress'

Right now, I'm putting each file into a temporary file with

	system("zcat $file > tempfile")

Then, I open 'tempfile,' work with it, close it, delete it, then repeat.

This doesn't seem to work very well, though.

--Joe

___________________________________________________________________________
D. Joe Anderson, Jr.		Dept. of Chemistry and Biochemistry
adrs@hydrogen.ucsc.edu		UCSC, Santa Cruz, CA  95064
408/459-3390			http://elmo.ucsc.edu/~adrs/



------------------------------

Date: Tue, 15 Sep 1998 20:41:51 +0100
From: Julian Gilbey <J.D.Gilbey@qmw.ac.uk>
Subject: Re: how to handle compressed text files
Message-Id: <35FEC2FF.5B9C434A@qmw.ac.uk>

adrs@chemistry.ucsc.edu wrote:
> 
> What is a good way to handle compressed files?  I have several text files
> I'd like to parse, each of which has been compressed with Unix 'compress'
> 
> Right now, I'm putting each file into a temporary file with
> 
>         system("zcat $file > tempfile")
> 
> Then, I open 'tempfile,' work with it, close it, delete it, then repeat.

If you don't need to seek through the files, you could do this:

open ZCAT_PIPE, "zcat $file |" or die "Couldn't zcat $file!";

and then you can read from <ZCAT_PIPE> as though it were a normal file,
except that you can only read successive lines, you can't jump to the
end or go backwards (`seeking').

   Julian

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

            Julian Gilbey             Email: J.D.Gilbey@qmw.ac.uk
       Dept of Mathematical Sciences, Queen Mary & Westfield College,
                  Mile End Road, London E1 4NS, ENGLAND
      -*- Finger jdg@goedel.maths.qmw.ac.uk for my PGP public key. -*-


------------------------------

Date: Tue, 15 Sep 1998 18:03:34 GMT
From: hex@voicenet.com (Matt Knecht)
Subject: Re: How to pass perl script's STDIN to Korn shell's ARGV
Message-Id: <WZxL1.40$Wo6.542086@news2.voicenet.com>

nguyen.van@imvi.bls.com <nguyen.van@imvi.bls.com> wrote:
>Hi guys,
>
>how can I pass a perl script's STDIN to be a korn shell script's argument.

You could start by reading the thread you initiated one day ago with the
exact same question!

Since you're already using dejanews try searching for:

~g comp.lang.perl.misc ~s Re: passing an argument.

Unfortunately, dejanews seems to lack a method to search by message id,
so I can't point you exactly anywhere.  If you want to see how I replied
append "~a Matt Knecht" to your search criteria.

I suggest reading the whole thread, though.

-- 
Matt Knecht - <hex@voicenet.com>


------------------------------

Date: 15 Sep 1998 08:18:52 +0200
From: cg@dhcpcl-129.cdg.acriter.nl (Cees de Groot)
Subject: Re: Perl & Java - differences and uses
Message-Id: <6tl0sc$epm@dhcpcl-129.cdg.acriter.nl>

Felix S. Gallo <fsg@newsguy.com> said:
>The indefatigable George Reese writes:
>>Freedom has no place in programming.  Period.
>
>Here we discover the crux of the problem: George Reese
>believes that hilariously nonsensical dogma, stated in an
>authoritative way, is a feasible substitute for a forebrain.
>
You're completely overreacting. I tend to agree with George: history learns
that software built in tightly defined programming languages turns out
to be better. Freedom does have a place in programming - on the style
level (how do you solve a certain problem, which algorithm do you use,
etcetera). On lower levels, such freedom works against you in the long term.

I'm not an academic, by the way (what a strange notion that only academics
would have good ideas on programming ;-}).

-- 
Cees de Groot               http://pobox.com/~cg          <cg@pobox.com>
--- We're hiring Java developers => www.acriter.com


------------------------------

Date: 15 Sep 1998 18:05:01 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Perl & Java - differences and uses
Message-Id: <6tma8d$ain$1@client3.news.psi.net>

Uri Guttman (uri@camel.fastserv.com) wrote on MDCCCXLI September MCMXCIII
in <URL: news:sark9358f8v.fsf@camel.fastserv.com>:
++ >>>>> "A" == Abigail  <abigail@fnx.com> writes:
++ 
++   A> It's not whether one uses method lookups or not. That's irrelevant.
++   A> The point is where data is *stored*, not how you access it. The
++   A> usual implementation of OO in Perl is by using a blessed
++   A> hash. Which means that all the classes use the same scribble area.
++ 
++ dearest sweet abby,
++ 
++ how about this idea to separate class data in an object. create a hash
++ ref as the top level object and its top level keys are the names of the
++ classes with another hash ref for a value. then each class can have its
++ own hash to scribble in. and if they behave nicely they can peek into
++ others in the same object by climbing up the class tree and looking at
++ those hashes. possibly even top level data can be kept in the object as
++ long as the keys are not in the form of a class name.

But how would the class now where to find its data? Realize that when
you write a class, you don't know whether it will be subclassed or not.



Abigail
-- 
perl -e '$a = q 94a75737420616e6f74686572205065726c204861636b65720a9 and
         ${qq$\x5F$} = q 97265646f9 and s g..g;
         qq e\x63\x68\x72\x20\x30\x78$&eggee;
         {eval if $a =~ s e..eqq qprint chr 0x$& and \x71\x20\x71\x71qeexcess}'


------------------------------

Date: 15 Sep 98 18:13:45 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: Perl & Java - differences and uses
Message-Id: <905883159.712866@thrush.omix.com>

Abigail <abigail@fnx.com> wrote:
        >snip<
: It's not whether one uses method lookups or not. That's irrelevant.
: The point is where data is *stored*, not how you access it. The usual
: implementation of OO in Perl is by using a blessed hash. Which means
: that all the classes use the same scribble area.
        >snip<
: I don't care about people keeping out if they really want in. But you
: don't want to accidentially use the same storage space for a piece of
: data as one of the classes you inherit does.
        >snip<

        Ah, I see.  Ala Java "private" variables, right?
        
        This is what I was working on, but using an array based object
        with sub constants of the indexes for field name lookups.  A
        kluge yes, but it worked and wasn't *that* bad.

        I stopped when fields.pm came out in 5.005 because it does nearly
        the same thing, but much, much cleaner and with core support
        and features that an array/constant method could never gain.

        So yes, Perl now has per-class "private" fields.

        Along the same lines, $@ can now hold a reference, allowing real
        object exceptions to be created.  No more brain dead eval/die with
        $@ string matching!

        sub some_method {
            if (some error) {
                ## Create exception
                $@ = new My::Exception (errstr => "Some error: $!");

                ## Throw it
                die;
            }
        }

: George is right in the sense that if you want a true OO environment,
: suitable for several programmers to work on the same project, Perl is
: a lousy choice.

        Maybe in past Perls these issues existed, but no longer now that
        5.005 is out. :-)

        See `perldoc fields' for more info.  I think you'll be very happy
        with this new release.

-- 
-Zenin (zenin@archive.rhps.org)           From The Blue Camel we learn:
BSD:  A psychoactive drug, popular in the 80s, probably developed at UC
Berkeley or thereabouts.  Similar in many ways to the prescription-only
medication called "System V", but infinitely more useful. (Or, at least,
more fun.)  The full chemical name is "Berkeley Standard Distribution".


------------------------------

Date: 15 Sep 1998 18:32:49 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: Perl & Java - differences and uses
Message-Id: <905884016.961445@thrush.omix.com>

Uri Guttman <uri@camel.fastserv.com> wrote:
        >snip<
: how about this idea to separate class data in an object. create a hash
: ref as the top level object and its top level keys are the names of the
: classes with another hash ref for a value. then each class can have its
: own hash to scribble in.

        So, you'd end up with stuff like:
        
        package Foo::Bar::Dog;
        sub some_method {
            my $self = shift;
            $self->{'Foo::Bar::Dog'}->{my_field} = 'my value';
        }
        
        This makes it much harder to swap package names and a few other
        problems.  You could do:
        
            $self->{ __PACKAGE__ }->{my_field} = 'my value';

        But I don't think that tag works as a hash key (it's seen
        as the string '__PACKAGE__').

        Either way, it's still ugly. :-)
        
: and if they behave nicely they can peek into
: others in the same object by climbing up the class tree and looking at
: those hashes.

        Tree?  So are you thinking of something like:
        
        package Foo::Bar::Dog;
        $self->{Foo}{Bar}{Dog}{my_field} = 'my_value';
        
        What happends when Foo::Bar wants the field name "Dog" later?

        How is a sub-class to know what is considered public and what
        is private?

: possibly even top level data can be kept in the object as
: long as the keys are not in the form of a class name.
: this could even be folded into some new syntax/semantics. when you
: dereference a hash object, you automatically get the current class's
: subhash.

        Luckily for us, this issue has already been covered pretty
        well in the newest version of perl, 5.005*.  See perldoc
        fields for more info.
-- 
-Zenin (zenin@archive.rhps.org)           From The Blue Camel we learn:
BSD:  A psychoactive drug, popular in the 80s, probably developed at UC
Berkeley or thereabouts.  Similar in many ways to the prescription-only
medication called "System V", but infinitely more useful. (Or, at least,
more fun.)  The full chemical name is "Berkeley Standard Distribution".


------------------------------

Date: Tue, 15 Sep 1998 18:57:02 GMT
From: George Reese <borg@imaginary.com>
Subject: Re: Perl & Java - differences and uses
Message-Id: <2MyL1.1837$E9.6166774@ptah.visi.com>

In comp.lang.java.programmer Abigail <abigail@fnx.com> wrote:
: George is right in the sense that if you want a true OO environment,
: suitable for several programmers to work on the same project, Perl is
: a lousy choice.

And this is a great summary of what I have basically been trying to
say all along.

-- 
George Reese (borg@imaginary.com)       http://www.imaginary.com/~borg
PGP Key: http://www.imaginary.com/servlet/Finger?user=borg&verbose=yes
   "Keep Ted Turner and his goddamned Crayolas away from my movie."
			    -Orson Welles


------------------------------

Date: 15 Sep 1998 19:16:22 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Perl & Java - differences and uses
Message-Id: <6tmee6$c5b$1@client3.news.psi.net>

Cees de Groot (cg@dhcpcl-129.cdg.acriter.nl) wrote on MDCCCXLI September
MCMXCIII in <URL: news:6tl0sc$epm@dhcpcl-129.cdg.acriter.nl>:
++
++ You're completely overreacting. I tend to agree with George: history learns
++ that software built in tightly defined programming languages turns out
++ to be better. Freedom does have a place in programming - on the style
++ level (how do you solve a certain problem, which algorithm do you use,
++ etcetera). On lower levels, such freedom works against you in the long term.

And which fact from history learns us that? The overwelming amount of
applications written in Pascal, with C not standing a chance? 

++ I'm not an academic, by the way (what a strange notion that only academics
++ would have good ideas on programming ;-}).

Indeed, as an academic wouldn't use "better" without stating which
definition of "better" (s)he was using.



Abigail
-- 
perl -we '$_ = q ?4a75737420616e6f74686572205065726c204861636b65720as?;??;
          for (??;(??)x??;??)
              {??;s;(..)s?;qq ?print chr 0x$1 and \161 ss?;excess;??}'


------------------------------

Date: Tue, 15 Sep 1998 19:39:20 GMT
From: "Michael T. Richter" <mtr@igs.net>
Subject: Re: Perl & Java - differences and uses
Message-Id: <InzL1.421$Of7.627582@198.235.216.4>

Abigail wrote in message <6tmee6$c5b$1@client3.news.psi.net>...
>++ You're completely overreacting. I tend to agree with George: history
learns
>++ that software built in tightly defined programming languages turns out
>++ to be better. Freedom does have a place in programming - on the style
>++ level (how do you solve a certain problem, which algorithm do you use,
>++ etcetera). On lower levels, such freedom works against you in the long
term.

>And which fact from history learns us that? The overwelming amount of
>applications written in Pascal, with C not standing a chance?

And how many of those C applications have bizarre errors, difficult (if not
impossible) to track down, caused by any of the following evils?:
- no automated memory management
- no boundary checks on array access
- trivial type casting
- assignment as expression

I would not hold up the software industry as it is now as an example of how
to do things right.  The popularity of C and its descendants is, I think,
directly responsible for the slipshod products being sold as software these
days.

--
Michael T. Richter    <mtr@ottawa.com>    http://www.igs.net/~mtr/
          PGP Key: http://www.igs.net/~mtr/pgp-key.html
PGP Fingerprint: 40D1 33E0 F70B 6BB5 8353 4669 B4CC DD09 04ED 4FE8




------------------------------

Date: 15 Sep 98 18:20:54 GMT
From: sf@sf.com (MercuryZ)
Subject: Perl Question for Unix gurus
Message-Id: <35feb006.0@news.ptw.com>

I want to automate downloads through Perl.  Lynx is my choice
for this.  Under the Unix shell I do something like this:
lynx www.yahoo.com/download.zip  and it will get the URL then
give me an option to download be pressing D or the option to
cancel by pressing C.  How, through Perl, do I get it to automatically
press C or D for me?  I have tried many ways and I cant find a
solution....please help!  

Thanks, Sean



------------------------------

Date: Tue, 15 Sep 1998 18:58:31 GMT
From: mfuhr@dimensional.com (Michael Fuhr)
Subject: Re: Perl Question for Unix gurus
Message-Id: <6tmdc8$r8b@flatland.dimensional.com>

sf@sf.com (MercuryZ) writes:

> I want to automate downloads through Perl.  Lynx is my choice
> for this.  Under the Unix shell I do something like this:
> lynx www.yahoo.com/download.zip  and it will get the URL then
> give me an option to download be pressing D or the option to
> cancel by pressing C.  How, through Perl, do I get it to automatically
> press C or D for me?  I have tried many ways and I cant find a
> solution....please help!  

This is mentioned in the Perl FAQ, Section 9:

    http://www.perl.com/CPAN/doc/manual/html/pod/perlfaq9.html

-- 
Michael Fuhr
http://www.fuhr.net/~mfuhr/


------------------------------

Date: 15 Sep 1998 19:41:13 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
Subject: Re: Perl Question for Unix gurus
Message-Id: <6tmfsp$g8t$1@info.uah.edu>

In article <35feb006.0@news.ptw.com>,
	sf@sf.com (MercuryZ) writes:
: I want to automate downloads through Perl.  Lynx is my choice
: for this.

You chose poorly.  You want to use LWP or perhaps Net::FTP, both of
which are available on the CPAN.

Greg
-- 
Why do people give each other flowers? To celebrate various important
occasions, they're killing living creatures? Why restrict it to plants?
"Sweetheart, let's make up.  Have this deceased squirrel."
    -- Jerry Seinfeld


------------------------------

Date: Tue, 15 Sep 1998 14:51:33 -0400
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: Re: print statement in perl
Message-Id: <Pine.GSO.3.96.980915144805.22148A-100000@crusoe.crusoe.net>

>     % In string, @cout now must be written as \@cout at
>       add.prl line 17, near "@sum \t @cout"
>       Execution of add.prl aborted due to compilation errors.

I believe this error is similar to this error:

eval '@array = qw( foo bar )';
print "@array\n";

The reason is, when you assign the typeglob (*cout = func(\@stuff)), you
are using the array form (@cout) for the first time in double quotes.  The
reason Perl barks at you is because it expects the ACTUAL @cout to be
mentioned somehow before it has any reason to use it in quotes.

Thus, the code should predeclare @cout, or, in my case:
@array = ();
eval '@array = qw ( foo bar )';
print "@array\n";


--
Jeff Pinyan (jeffp@crusoe.net)
www.crusoe.net/~jeffp

Crusoe Communications, Inc.
973-882-1022
www.crusoe.net



------------------------------

Date: 15 Sep 1998 17:56:13 GMT
From: gebis@fee.ecn.purdue.edu (Michael J Gebis)
Subject: Re: Who posts original posts on CLPM?
Message-Id: <6tm9nt$rph@mozo.cc.purdue.edu>

lr@hpl.hp.com (Larry Rosler) writes:

}How about the ridiculous assumptions that the choice of a newsreader 
}correlates with the choice of a primary programming environment, and that 
}either correlates with programming experience or philosophy?  This thread 
}can lead nowhere except to perpetuate prejudicial stereotypes.

I like the fact that my news agent is listed as "NN Version."

I'm disappointed by the fact that I'm apparently the only one using
"NN Version."  I'm just old-school, I guess.  

-- 
Mike Gebis  gebis@ecn.purdue.edu  mgebis@eternal.net


------------------------------

Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>


Administrivia:

Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.

If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu. 


The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V8 Issue 3721
**************************************

home help back first fref pref prev next nref lref last post