[30395] in Perl-Users-Digest
Perl-Users Digest, Issue: 1638 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jun 13 11:09:47 2008
Date: Fri, 13 Jun 2008 08:09:10 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Fri, 13 Jun 2008 Volume: 11 Number: 1638
Today's topics:
Re: calling external program tiff2pdf (Jens Thoms Toerring)
Re: calling external program tiff2pdf <john1949@yahoo.com>
Re: calling external program tiff2pdf <danrumney@warpmail.net>
Re: calling external program tiff2pdf <john1949@yahoo.com>
Re: FAQ 7.14 What is variable suicide and how can I pre <brian.d.foy@gmail.com>
Re: How Does One Implement a Timer in Perl? <jurgenex@hotmail.com>
Re: How to unpack long long ? <tzz@lifelogs.com>
Re: Learning Perl <benkasminbullock@gmail.com>
Re: Learning Perl <uri@stemsystems.com>
Re: Learning Perl <uri@stemsystems.com>
Re: Learning Perl <brian.d.foy@gmail.com>
Re: Learning Perl (Randal L. Schwartz)
Simple scrape with perl on google news <nevenbartel@gmail.com>
Re: Simple scrape with perl on google news <greymausg@mail.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 13 Jun 2008 10:47:32 GMT
From: jt@toerring.de (Jens Thoms Toerring)
Subject: Re: calling external program tiff2pdf
Message-Id: <6bf1i4F3arn58U1@mid.uni-berlin.de>
John <john1949@yahoo.com> wrote:
> Part of program
> my $filename="fred.tiff";
> my $newfile="john.pdf";
> system ("tiff2pdf -o $newfile $filename");
> There is no conversion.
I guess you shouldn't have a space between the '-o' and the
'$newfile'.
Regards, Jens
--
\ Jens Thoms Toerring ___ jt@toerring.de
\__________________________ http://toerring.de
------------------------------
Date: Fri, 13 Jun 2008 11:58:18 +0100
From: "John" <john1949@yahoo.com>
Subject: Re: calling external program tiff2pdf
Message-Id: <g2tjs9$oqd$1@news.albasani.net>
"Jens Thoms Toerring" <jt@toerring.de> wrote in message
news:6bf1i4F3arn58U1@mid.uni-berlin.de...
> John <john1949@yahoo.com> wrote:
>> Part of program
>
>> my $filename="fred.tiff";
>> my $newfile="john.pdf";
>> system ("tiff2pdf -o $newfile $filename");
>
>> There is no conversion.
>
> I guess you shouldn't have a space between the '-o' and the
> '$newfile'.
> Regards, Jens
> --
> \ Jens Thoms Toerring ___ jt@toerring.de
> \__________________________ http://toerring.de
Hi
Tried that but it didn't work.
It is strange since it works on the linux command line when I key in
tiff2pdf -o john.pdf fred.tiff
Odd.
John
------------------------------
Date: Fri, 13 Jun 2008 09:37:45 -0400
From: Dan Rumney <danrumney@warpmail.net>
Subject: Re: calling external program tiff2pdf
Message-Id: <4852781a$0$31731$4c368faf@roadrunner.com>
John wrote:
> Hi
>
> Part of program
>
> my $filename="fred.tiff";
> my $newfile="john.pdf";
> system ("tiff2pdf -o $newfile $filename");
>
> There is no conversion.
>
> I've tried "./tiff2pdf" also.
>
> Any ideas?
> John
>
>
Try adding:
if ($? == -1)
{
print "failed to execute: $!\n";
}
elsif ($? & 127)
{
printf "child died with signal %d, %s coredump\n",
($? & 127), ($? & 128) ? 'with' : 'without';
}
else
{
printf "child exited with value %d\n", $? >> 8;
}
after your call to system (per perldoc).
Then run the script
Then, if you're still none the wiser, post the full output from the
script to this newsgroup... we might be able to help a little more.
------------------------------
Date: Fri, 13 Jun 2008 15:14:59 +0100
From: "John" <john1949@yahoo.com>
Subject: Re: calling external program tiff2pdf
Message-Id: <g2tvd1$epa$1@news.albasani.net>
"John" <john1949@yahoo.com> wrote in message
news:g2td8d$bs7$1@news.albasani.net...
> Hi
>
> Part of program
>
> my $filename="fred.tiff";
> my $newfile="john.pdf";
> system ("tiff2pdf -o $newfile $filename");
>
> There is no conversion.
>
> I've tried "./tiff2pdf" also.
>
> Any ideas?
> John
>
Hi, all
Manage to crack it. You need to place all parameters in quotes including
the -o.
system ("tiff2pdf","-o","$newfile","$filename")
Many thanks
John
------------------------------
Date: Fri, 13 Jun 2008 08:32:44 -0500
From: brian d foy <brian.d.foy@gmail.com>
Subject: Re: FAQ 7.14 What is variable suicide and how can I prevent it?
Message-Id: <130620080832444023%brian.d.foy@gmail.com>
In article
<9bb88369-16f4-4e91-b51d-de7e70da207c@f63g2000hsf.googlegroups.com>,
Bill H <bill@ts1000.us> wrote:
> On Jun 12, 10:27 am, brian d foy <brian.d....@gmail.com> wrote:
> > In article
> > <a72f0e8e-7e89-4655-a129-56f5e42af...@t54g2000hsg.googlegroups.com>,
> >
> > You mean what to do to prevent vaiable suicide? It's the first sentence
> > of the answer: upgrade Perl.
>
> I totally didnt see that. Maybe that should be at the end of the
> explanation of what the problem is (also?).
I don't thin it can be anymore prominent than the first sentence. If
people don't want to read the first sentence, they may not want to read
any particular sentence so its pointless to litter an answer with the
same thing over and over again hoping that the reader sees just one of
them. :)
------------------------------
Date: Fri, 13 Jun 2008 11:11:12 GMT
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: How Does One Implement a Timer in Perl?
Message-Id: <tbl454l5ldtgl7om2tfpvlv10g2hasu047@4ax.com>
fishfry <BLOCKSPAMfishfry@your-mailbox.com> wrote:
>In article <1194371465.172543.212450@e9g2000prf.googlegroups.com>,
> kvnsmnsn@hotmail.com wrote:
>> Is there a way in Perl to [...] to suspend execution until five
>> seconds have past or until a response has come, whichever happens
>> first?
Your Question is Asked Frequently: perldoc -q timeout
jue
------------------------------
Date: Fri, 13 Jun 2008 10:03:37 -0500
From: Ted Zlatanov <tzz@lifelogs.com>
Subject: Re: How to unpack long long ?
Message-Id: <86d4mlml6e.fsf@lifelogs.com>
On Fri, 13 Jun 2008 02:02:44 GMT Uri Guttman <uri@stemsystems.com> wrote:
>>>>>> "BM" == Ben Morrow <ben@morrow.me.uk> writes:
BM> Quoth Uri Guttman <uri@stemsystems.com>:
>>> >>>>> "BM" == Ben Morrow <ben@morrow.me.uk> writes:
>>>
BM> [unpack 'q' in 32bit perl]
>>>
BM> If you know the endianness and know the value will be small, or if you
BM> use bigint, you can easily unpack as two longs and combine them.
>>>
>>> but that isn't really unpacking them. it is reordering bytes and it
>>> still is a byte string. 32 bit perl has no direct way to interact with
>>> 64 bit numbers (some modules do xs trickery to hold 64 bit values like
>>> Time::HiRes). so unpacking 8 bytes to 64 bits makes no sense in 32 bit
>>> perl.
BM> I meant something along the lines of
BM> use bigint;
BM> my ($l1, $l2) = unpack 'll', $quad;
BM> my $num = ($l2<<32) + $l1;
BM> (assuming LE quads). If you know the values will be below 2**53 and
BM> replace '<<32' with '* 2**32' this will work without 'bigint'.
UG> i understood your intent but your original comment overrides that. 32
UG> bit perl can't handle 64 bit numbers. putting them into a double isn't
UG> the same thing.
Why should the user care about the internal details? Math::BigInt
should take care of all that, using XS or whatever it needs to. The
user just wants to unpack a 64-bit value into something Perl can use
further, and it doesn't have to be in the binary numeric format of the
platform. It can be a chain of 4-bit values as long as it works.
If bigint is a pragma now, why not change pack/unpack to DTRT with `q'
on 32-bit when bigint is in use? It seems much nicer than just giving
up (though the slowdown might be unexpected for the end user, so perhaps
pack/unpack should be overridden only on demand).
Ted
------------------------------
Date: Fri, 13 Jun 2008 10:26:15 +0000 (UTC)
From: Ben Bullock <benkasminbullock@gmail.com>
Subject: Re: Learning Perl
Message-Id: <g2ti07$i0p$1@ml.accsnet.ne.jp>
On Thu, 12 Jun 2008 19:04:46 +0000, Uri Guttman wrote:
> the problem is that most learning users of perl don't know enough perl
> or how to teach to explain things correctly and with enough depth and
> coverage.
The other problem is that the people who do know enough Perl seem to
prefer writing incomprehensible gibberish ("Camel Books", "perldoc
perlre", etc.) to writing something that normal people can understand.
> Operator to force a list into scalar context
>
> ok, that is classicly wrong. there is no such thing as a list in scalar
> context. it should be an array, not list.
Is it?
> these flash cards don't seem to be useful IMO. they are not deep enough
> and there is no explanations of anything, just a simple question and
> answer.
But a simple question and answer might be more useful to beginners than a
more involved discussion.
> there could be links to the docs, more info in each answer,
> better grouping of questions, etc.
Then they'd be completely inaccessible to beginners.
> Syntax for looping through the values in a list
> foreach $var @array {
> }
>
> that should be my $var.
Why, though? Who's to say that $var isn't declared previously?
> Operators to add and remove items from the beginning of array
> unshift(@array, new_item)
> shift(@array)
>
> what is new_item? unless that is a predeclared sub with a prototype it
> is illegal. and it doesn't mention unshift takes a list.
Yes, you are right. Here's an idea: why don't you go and invade one of
the local schools where you live, get hold of a maths
textbook for five-year-olds, and run around the school screaming,
ranting and shouting at the top of your voice, because it doesn't
contain every single detail about Lebesgue integration over the field
of real numbers? Or you could try the science textbooks for the ten-year-
olds: how about having a good old rant if they don't give an
thorough explanation of Einstein's General Theory of Relativity
complete with equations?
Oh, yes, that's right, people who are starting to learn something
don't usually learn all the details at first.
> nor does it say
> which function adds or removes (sure they are in the order mentioned in
> the question but it should be pointed out. the same is true for the
> push/pop slide.
Yes, if you don't add more and more details to the explanation, it
won't be confusing enough for a complete beginner, then they won't
feel frustrated, give up, and go and learn Python instead.
> the slides always say operator for what most call functions. sure they
> are operators in some sense (they don't always need parens) but it is
> poor terminology to always say operator.
Again, unless it's vitally important, tortured details like this don't
really belong in explanations for beginners. People can learn the details
once they've grasped the concepts more clearly.
> When using qw how do you include the characters in strings that
> you are using for qw delimiter
> escape them with backslash
>
> qw! string\!1 string\!2 ....!
>
> wow. i can't recall ever needing to escape inside a qw! and most qw's
> use matched delimiters or maybe //. no one uses ! !!!
So first you complain that it's too simple, then you complain that
it's too complex?
> When using qw (quote word) shorcut what other symbols can be
> used as the delimiter besides ( )
>
> any
>
> qw# string1 string2 #
> qw! string1 string2 !
>
> another wow. explaining about alternate delimiters in general (given the
> 8 or so ops that support them) would be better.
It would be better, except for the well-known fact that it's much easier
on the human brain to start with a concrete example, then work towards
the general case, than it is to start with the general case. For example,
we learn arithmetic before we learn algebra, we learn to walk before we
learn to run, etc.
> this is why this single
> question flash card thing is not a good idea IMO. it stresses studying
> for the test (like an MSCE!) and not deeper understanding.
What test?
> What is the syntax for a list literal
> ( value1, value2, ....)
>
> huh? that is a list. literals are possible values in the list.
>
> What is the effect of using negative number for an array index
> it starts counting from the end of the array backwards
>
> that is from the department of redundant answers department.
Sorry, but I don't see why it is redundant. That seems like a useful
piece of knowledge to me. C programmers who used a negative number in an
array index would expect to get a crash and a "segmentation fault" error,
so why is it redundant to point out that Perl is different from C here?
> How do you access an element in an array
> use [ ]
> x[3];
>
> i see a syntax bug there!
Agreed, this is an error. If Larry Wall forgot a dollar we'd call it a
"typo" though. So we've established that there are a few typos in the
test.
> What value do variables hold until defined
> undef
>
> hmm. do arrays and hashes hold undef? that should be scalar variables.
Again, too many details. To understand "What value do scalar variables
hold until defined" is just confusing unless one can instantly remember
what "scalar variable" means, which for a beginner is not a given. It
would be better to phrase the question like this:
When we declare a new variable $var with
my $var;
what value does $var contain initially?
There are ways to phrase things so that they are easy to understand and
also not incorrect.
> Comparison operator for numbers
> ==
>
> hmm, i wonder what >, <, >= and <= have to say about that?
> s/Comparison/Equality/
As far as I know, the comparison operator for numbers is <=>.
> How are all numbers stored interally by Perl
> double-precision floating-point values
>
> hmm, i wonder what IV's have to say about that?
The question is a bit weird, I don't know how numbers are stored
internally by Perl.
> How can you run Perl with warnings enabled
> -e
> perl -e program_name
>
> whoops!! that flash card should be flashing red!
>
> so as you can see, this site needs plenty of fixes and editing and it
> doesn't seem to be too helpful.
It needs a few fixes. Trying too hard to find fault with it by
harshly criticising stuff which isn't really broken is counterproductive
though.
> simple questions like these is not the
> way to learn programming in any language.
Hmm, I have no idea, but since there are millions of people out there,
who knows, perhaps it is useful for someone. I don't think it's harmful.
------------------------------
Date: Fri, 13 Jun 2008 12:51:58 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Learning Perl
Message-Id: <x7tzfxa45u.fsf@mail.sysarch.com>
>>>>> "BB" == Ben Bullock <benkasminbullock@gmail.com> writes:
BB> On Thu, 12 Jun 2008 19:04:46 +0000, Uri Guttman wrote:
>> the problem is that most learning users of perl don't know enough perl
>> or how to teach to explain things correctly and with enough depth and
>> coverage.
BB> The other problem is that the people who do know enough Perl seem to
BB> prefer writing incomprehensible gibberish ("Camel Books", "perldoc
BB> perlre", etc.) to writing something that normal people can understand.
and how much technical writing or editing have you done?
>> Operator to force a list into scalar context
>>
>> ok, that is classicly wrong. there is no such thing as a list in scalar
>> context. it should be an array, not list.
BB> Is it?
yes. this has been covered here many times.
>> these flash cards don't seem to be useful IMO. they are not deep enough
>> and there is no explanations of anything, just a simple question and
>> answer.
BB> But a simple question and answer might be more useful to beginners than a
BB> more involved discussion.
simple answers out of context are not useful. have you ever given a
class in perl? you have to be able to explain things beyond basic facts.
>> there could be links to the docs, more info in each answer,
>> better grouping of questions, etc.
BB> Then they'd be completely inaccessible to beginners.
nope. you can do that very easily. links to the online docs at
perldoc.perl.org are trivial to make.
>> Syntax for looping through the values in a list
>> foreach $var @array {
>> }
>>
>> that should be my $var.
BB> Why, though? Who's to say that $var isn't declared previously?
and then that would be a likely bug. foreach localizes its loop variable
which would mask the my var. please learn perl before you critique a
critique of a tutorial
perl -le 'my $x = 1 ; for $x ( 1 .. 3 ) {print $x} print $x'
1
2
3
1
>> Operators to add and remove items from the beginning of array
>> unshift(@array, new_item)
>> shift(@array)
>>
>> what is new_item? unless that is a predeclared sub with a prototype it
>> is illegal. and it doesn't mention unshift takes a list.
BB> Oh, yes, that's right, people who are starting to learn something
BB> don't usually learn all the details at first.
but correct syntax is needed. or an explanation of what 'new_item' is.
>> nor does it say
>> which function adds or removes (sure they are in the order mentioned in
>> the question but it should be pointed out. the same is true for the
>> push/pop slide.
BB> Yes, if you don't add more and more details to the explanation, it
BB> won't be confusing enough for a complete beginner, then they won't
BB> feel frustrated, give up, and go and learn Python instead.
nope. they would be pissed at the teacher.
>> the slides always say operator for what most call functions. sure they
>> are operators in some sense (they don't always need parens) but it is
>> poor terminology to always say operator.
BB> Again, unless it's vitally important, tortured details like this don't
BB> really belong in explanations for beginners. People can learn the details
BB> once they've grasped the concepts more clearly.
nope. correct terminology makes it easier to understand and causes fewer
problems later on.
>> When using qw how do you include the characters in strings that
>> you are using for qw delimiter
>> escape them with backslash
>>
>> qw! string\!1 string\!2 ....!
>>
>> wow. i can't recall ever needing to escape inside a qw! and most qw's
>> use matched delimiters or maybe //. no one uses ! !!!
BB> So first you complain that it's too simple, then you complain that
BB> it's too complex?
complex?? showing qw{} vs qw!! is complex? you have a strange view if
that is complex.
>> When using qw (quote word) shorcut what other symbols can be
>> used as the delimiter besides ( )
>>
>> any
>>
>> qw# string1 string2 #
>> qw! string1 string2 !
>>
>> another wow. explaining about alternate delimiters in general (given the
>> 8 or so ops that support them) would be better.
BB> It would be better, except for the well-known fact that it's much easier
BB> on the human brain to start with a concrete example, then work towards
BB> the general case, than it is to start with the general case. For example,
BB> we learn arithmetic before we learn algebra, we learn to walk before we
BB> learn to run, etc.
and you don't get teaching perl or programming languages. sure you start
simple but the concept of alternate delims is a simple one.
>> this is why this single
>> question flash card thing is not a good idea IMO. it stresses studying
>> for the test (like an MSCE!) and not deeper understanding.
BB> What test?
flash cards are a classic method to learn rote material. they rarely
require the need to think. as such they are used for tests covering
finite subject matter. perl is not a finite nor is even a small subset
that easy to rote learn. programming is more about concepts than
details. again, you haven't done any training nor writing if you think
rote learning is a good way to teach perl.
>> What is the syntax for a list literal
>> ( value1, value2, ....)
>>
>> huh? that is a list. literals are possible values in the list.
>>
>> What is the effect of using negative number for an array index
>> it starts counting from the end of the array backwards
>>
>> that is from the department of redundant answers department.
BB> Sorry, but I don't see why it is redundant. That seems like a useful
BB> piece of knowledge to me. C programmers who used a negative number in an
BB> array index would expect to get a crash and a "segmentation fault" error,
BB> so why is it redundant to point out that Perl is different from C here?
hmm, what other direction can you count from the end ot the array?
>> How do you access an element in an array
>> use [ ]
>> x[3];
>>
>> i see a syntax bug there!
BB> Agreed, this is an error. If Larry Wall forgot a dollar we'd call it a
BB> "typo" though. So we've established that there are a few typos in the
BB> test.
50 questions and answers and 1 typo. maybe 3 pages of text. if i saw a
book with such a ratio i would puke. i have tech edited 4 perl books and
none had such a ratio of typos. poor writing and little editing is
obvious here.
>> What value do variables hold until defined
>> undef
>>
>> hmm. do arrays and hashes hold undef? that should be scalar variables.
BB> Again, too many details. To understand "What value do scalar variables
BB> hold until defined" is just confusing unless one can instantly remember
BB> what "scalar variable" means, which for a beginner is not a given. It
BB> would be better to phrase the question like this:
BB> When we declare a new variable $var with
BB> my $var;
BB> what value does $var contain initially?
and when you declare my @array or %hash, what does it contain initially?
arrays and hashes are variables too. and should be covered as much if
not more than scalars
BB> There are ways to phrase things so that they are easy to understand and
BB> also not incorrect.
>> Comparison operator for numbers
>> ==
>>
>> hmm, i wonder what >, <, >= and <= have to say about that?
>> s/Comparison/Equality/
BB> As far as I know, the comparison operator for numbers is <=>.
so you think the q/a is wrong too!
>> How are all numbers stored interally by Perl
>> double-precision floating-point values
>>
>> hmm, i wonder what IV's have to say about that?
BB> The question is a bit weird, I don't know how numbers are stored
BB> internally by Perl.
then why is it being asked? and why would you think it is important or
not? why did you comment?
>> How can you run Perl with warnings enabled
>> -e
>> perl -e program_name
>>
>> whoops!! that flash card should be flashing red!
>>
>> so as you can see, this site needs plenty of fixes and editing and it
>> doesn't seem to be too helpful.
BB> It needs a few fixes. Trying too hard to find fault with it by
BB> harshly criticising stuff which isn't really broken is counterproductive
BB> though.
a few? this was 50 questions. i found 15+ mistakes or bad wording. that
is an awfully high ratio.
>> simple questions like these is not the
>> way to learn programming in any language.
BB> Hmm, I have no idea, but since there are millions of people out there,
BB> who knows, perhaps it is useful for someone. I don't think it's harmful.
you haven't seen enough bad perl tutorials. google for them and then
come back. the harm of them is way beyond your knowledge. ever heard of
matt's scripts and the damage they caused perl for years?
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.sysarch.com --
----- Perl Code Review , Architecture, Development, Training, Support ------
--------- Free Perl Training --- http://perlhunter.com/college.html ---------
--------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------
------------------------------
Date: Fri, 13 Jun 2008 12:52:51 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Learning Perl
Message-Id: <x7prqla44c.fsf@mail.sysarch.com>
>>>>> "BB" == Ben Bullock <benkasminbullock@gmail.com> writes:
BB> On Thu, 12 Jun 2008 09:52:52 -0700, Elizabeth Barnwell wrote:
>> Here is a set of flashcards our developers have been using to learn
>> Perl with very good results:
>>
>> http://www.yoyobrain.com/subjects/show/3121
>>
>> Add the subject to your study materials, click on try a learning
>> drill.
BB> That looks very useful.
only to those that don't know about teaching perl. sorry but this is no
better than the rest of the poor perl tutorials on the net.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.sysarch.com --
----- Perl Code Review , Architecture, Development, Training, Support ------
--------- Free Perl Training --- http://perlhunter.com/college.html ---------
--------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------
------------------------------
Date: Fri, 13 Jun 2008 08:38:13 -0500
From: brian d foy <brian.d.foy@gmail.com>
Subject: Re: Learning Perl
Message-Id: <130620080838133741%brian.d.foy@gmail.com>
In article
<dfa1a2b1-0455-4bf1-9cf8-9525335f1ed5@56g2000hsm.googlegroups.com>,
Elizabeth Barnwell <elizabethbarnwell@gmail.com> wrote:
> Here is a set of flashcards our developers have been using to learn
> Perl with very good results:
I saw those, and about half of the Perl answers were wrong, and many of
the Perl *questions* were wrong too. Everyone should stay away from
this Perl stuff, at least until the information is fixed. You might,
for
example, read my book called "Learning Perl" :)
I guess the technology is okay, but I don't see the point of trying to
learn a programming language without actually programming. Memorization
isn't worth much when you should be able to look up anything you need
at the same time you are programming.
------------------------------
Date: Fri, 13 Jun 2008 06:44:20 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Learning Perl
Message-Id: <86r6b1tpor.fsf@blue.stonehenge.com>
>>>>> "Jim" == Jim Cochrane <allergic-to-spam@no-spam-allowed.org> writes:
Jim> IOW, in Perl, a semicolon is a statement separator, not a statement
Jim> terminator.
No, you're recalling Pascal.
In Perl, it is indeed a statement terminator, but only for those statements
that require it (not a while or an if, for example). However, the final
semicolon of any scope (file or block or eval-string) is optional.
print "Just another Perl hacker,"; # the original
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion
------------------------------
Date: Fri, 13 Jun 2008 05:28:07 -0700 (PDT)
From: jjquery <nevenbartel@gmail.com>
Subject: Simple scrape with perl on google news
Message-Id: <89d3fbea-1ccb-4c60-b829-d2f0c1427dcc@m3g2000hsc.googlegroups.com>
Hi,
my perl skills have become really crappy, as I hardly ever use them.
But now a business problem has shown up. Anybody with good perl skills
should be able to solve this within a few minutes (REWARD below):
I would like that upon calling up the script that the following link
http://news.google.com/news?hl=en&ned=us&q=iraq&btnG=Search ("URL")
is searched for the string ("Search string")
"Results 1 - x of x for iraq"
and extracts the
"x"
and writes this to a file ("target file") together with the date and
time.
Can anybody give me a hand and provide me the code?
If you can provide me the code where I can configure the variables:
"URL"
"search string"
"target file"
and I can get it running ( I have a website with full perl
capabilities) on my own, you get US$10 to a paypal account. ;-)
Thanx, -n
------------------------------
Date: 13 Jun 2008 14:38:07 GMT
From: greymaus <greymausg@mail.com>
Subject: Re: Simple scrape with perl on google news
Message-Id: <slrng54uju.hiu.greymausg@maus.org>
On 2008-06-13, jjquery <nevenbartel@gmail.com> wrote:
> Hi,
>
> my perl skills have become really crappy, as I hardly ever use them.
> But now a business problem has shown up. Anybody with good perl skills
> should be able to solve this within a few minutes (REWARD below):
>
> I would like that upon calling up the script that the following link
>
> http://news.google.com/news?hl=en&ned=us&q=iraq&btnG=Search ("URL")
>
> is searched for the string ("Search string")
>
> "Results 1 - x of x for iraq"
>
> and extracts the
>
> "x"
>
> and writes this to a file ("target file") together with the date and
> time.
>
> Can anybody give me a hand and provide me the code?
>
> If you can provide me the code where I can configure the variables:
>
> "URL"
> "search string"
> "target file"
>
> and I can get it running ( I have a website with full perl
> capabilities) on my own, you get US$10 to a paypal account. ;-)
>
> Thanx, -n
1)
You can do that very easily with the libwww modules, or more upmarket
WWW::Mechanize. Read them up.
2) Google will _not_ like that. And Google is one of the wealthiest
enteties on the planet.
3) Getting too many results down too quickly will have your _real_ (URL)
address blocked either for a short or long period from Google.
send an unmungable munged email account.
--
Greymaus
The Republic says \"No\"
Big Ian for president.
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
#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.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
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.
#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 V11 Issue 1638
***************************************