[11157] in Perl-Users-Digest
Perl-Users Digest, Issue: 4757 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jan 26 23:07:17 1999
Date: Tue, 26 Jan 99 20:00:20 -0800
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, 26 Jan 1999 Volume: 8 Number: 4757
Today's topics:
Re: Anyone know of a stock quote script? (Larry Rosler)
Re: Blank Line in Format: how do I get one? <rick.delaney@home.com>
Re: CONCLUSIVE PROOF: The Beatles are bigger than Jesus <bjday@sonic.net>
Re: CONCLUSIVE PROOF: The Beatles are bigger than Jesus <bjday@sonic.net>
Re: CONCLUSIVE PROOF: The Beatles are bigger than Jesus (Spider Fighter)
Re: dupes in Perl <staffan@ngb.se>
Re: dupes in Perl <rick.delaney@home.com>
re: dupes in Perl (Larry Rosler)
Re: Help a newbie with a custom shipping script? (Mike Stok)
HELP! how to use an IO::Handle as a filehandle (glob r <adam@Tut.CS.UCLA.EDU>
Re: How long would the Unixes last without Perl? (Abigail)
Re: How long would the Unixes last without Perl? (Mike Stok)
Re: how to return multiple values in perl? scraig@my-dejanews.com
HTML files exported from Quark <buttrick@sportingnews.com>
indexing binary data <edan@mtu.edu>
Is this possible? (Jim Matzdorff)
Re: Jesus Rides a HOG(tm) : was :CONCLUSIVE PROOF: The (Ears)
Re: Number manipulation and time formats (Abigail)
Perl print ("....."); command problems expoinfo@globalexpos.co.nz
Re: perlcc problem (some compilled programs doesn't run <brucem@library.ucdavis.edu>
perlipc examples fail with WebSTAR server <jc@uwm-dev.gte.com>
Re: Pleeeeeassee help!!! <gwynne@utkux.utk.edu>
Re: Regex for splitting this... <staffan@ngb.se>
split file into multiple... <rahulk@iname.com>
system function, Pros and Cons?? <jeff@toad.net>
Re: tryin' to learn <rick.delaney@home.com>
Re: using # as literal '#' in a cgi <jc@uwm-dev.gte.com>
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 26 Jan 1999 19:01:09 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Anyone know of a stock quote script?
Message-Id: <MPG.1118214773c772ff9899cd@nntp.hpl.hp.com>
In article <78lqei$rna$1@nnrp1.dejanews.com> on Wed, 27 Jan 1999
01:34:10 GMT, dturley@pobox.com <dturley@pobox.com> says...
> In article <78kjlg$64o$0@205.211.154.11>,
> cypher5@yahoo.die.spammers.com (Cypher) wrote:
> > Hi,
> > I'm looking for a stock quoting script that would send thw output to
> > email. Does anyone know of such a script?
> > All I need is the ticker symbol and the current value (Last traded at)
> > to be sent to an email message.
>
> Check out the Finance::YahooQuote and MoneyNetSymbolLookup modules. They will
> probably give you the info you need, extract it and email it. I've used them
> to both loo up symbols and get quotes.
>
> Hopefully this answer is acceptable to Mr. Larry "I led the standardization
> of the C language" Rosler. I would hate to get anymore of his snotty,
> holier-than- thou email correcting honest oversights.
Hmmm... You have a serious personality disorder indeed. Maybe PLONK!
is the right answer after all. There's always a first time.
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Wed, 27 Jan 1999 03:11:47 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: Blank Line in Format: how do I get one?
Message-Id: <36AE85CB.BD3E7605@home.com>
[posted & mailed]
Jessica Sockel wrote:
>
> I just want a blank line at the end of my format.
You're going to kick yourself.
>
> format UN_UIC_EX_FL =
> @<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<~
> $uname, $uic
> Flags: ~@<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Exp:
> @<<<<<<<<<<<<<<<<<<<<<<<<
> $flag, $expire
> .
Just add an extra newline before the dot.
--
Rick Delaney
rick.delaney@shaw.wave.ca
------------------------------
Date: 27 Jan 1999 02:56:08 GMT
From: Barbara Day <bjday@sonic.net>
Subject: Re: CONCLUSIVE PROOF: The Beatles are bigger than Jesus!
Message-Id: <78lv88$cr0$1@ultra.sonic.net>
Jeez...another loon for Christ.
------------------------------
Date: 27 Jan 1999 03:03:33 GMT
From: Barbara Day <bjday@sonic.net>
Subject: Re: CONCLUSIVE PROOF: The Beatles are bigger than Jesus!
Message-Id: <78lvm5$cua$1@ultra.sonic.net>
The posting above is under my wife's name, but make no mistake, I was the
author. Please, for goodness sake-it is just a song. Let it go at that,
and please take your political drivel, conservative-liberal or whatever,
and go somewhere else. I love astronomy and optics and don't give a damn
for your pseudo-analysis of some mundane rock and roll song. The cat was
an artist shot by a loon. Don't make more of it than necessary.
Howard Day
------------------------------
Date: Wed, 27 Jan 1999 03:11:43 GMT
From: spiderfighter@REMOVETHISTOEMAILMEhotmail.com (Spider Fighter)
Subject: Re: CONCLUSIVE PROOF: The Beatles are bigger than Jesus!
Message-Id: <36af83a1.3493657@news.capital.net>
On 27 Jan 1999 03:03:33 GMT, Barbara Day <bjday@sonic.net> wrote:
>The posting above is under my wife's name, but make no mistake, I was the
>author. Please, for goodness sake-it is just a song. Let it go at that,
>and please take your political drivel, conservative-liberal or whatever,
>and go somewhere else. I love astronomy and optics and don't give a damn
>for your pseudo-analysis of some mundane rock and roll song. The cat was
>an artist shot by a loon. Don't make more of it than necessary.
>Howard Day
Well, _that_ was interesting.
Please don't post this thread to the rec.games.video.nintendo newsgroup any more.
Thanks.
-SF.
====================================================
"If a man speaks in the woods and no woman is around
to hear him, is he still wrong?"
=====================================================
------------------------------
Date: Wed, 27 Jan 1999 03:16:07 +0100
From: Staffan Liljas <staffan@ngb.se>
Subject: Re: dupes in Perl
Message-Id: <36AE76E7.4D8E263B@ngb.se>
dturley@pobox.com wrote:
> Larry Rosler send in email:
> >This also deletes entries whose value is false, such as '0', as is
> >mentioned in the FAQ you copied this from. Why not simply aim the
> >questioner to the FAQ (as two of us have already), so he can get the
> >whole story?
> Well, excuse the fuck out of me. I didn't realize that the great Larry
> Rosler could see all the way to VA to know where I got that. I pulled
> it out of a piece of code I've been using in project for 2 years. I
> have no idea where I originally got it. Also, dickhead, when I posted
> my answer no other replies had made it to the news service I was
> looking at. I certainly would have never replied had I known the great
> Larry Rosler would have such a fit. I have no problem with you
> correcting the code, since I didn't realized the problem, but don't
> cop such a holier-than-thou attitude. Or are you such an asshole all
> the time?
What exactly do you mean by "I have no problem with you correcting the
code", when you apparently do? Larry is, as far as I can see, quite
polite. He made a false conclusion, though without reason, and he didn't
call you names.
Let's not resort to namecalling, we're all better than topmind, aren't
we? (And he didn't even use 'dickhead', as far as I recall)
Staffan
------------------------------
Date: Wed, 27 Jan 1999 02:25:04 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: dupes in Perl
Message-Id: <36AE7AC9.15BBE22F@home.com>
[posted & mailed]
dturley@pobox.com wrote:
>
> Larry Rosler send in email:
>
> In reply to your message entitled "Re: Deleting dupes with Perl":
> >[Posted and a courtesy copy mailed.]
> >
> >In article <78l8t4$dbh$1@nnrp1.dejanews.com> on Tue, 26 Jan 1999
> >20:34:45 GMT, dturley@pobox.com <dturley@pobox.com> says...
> >> In article <78km8q$ss6$1@nnrp1.dejanews.com>,
> >> jxdub@my-dejanews.com wrote:
> >> > but now I need to delete the
> >> > duplicates... Could anyone tell me a good way to do this? The file would
> >>
> >> here's one way. put the file into @out, sort it, then print it.
> >>
> >> @sorted = sort @out;
> >> $prev = 'nonesuch';
> >> @n_out = grep($_ ne $prev && ($prev = $_), @sorted); #remove duplicates
> >
> >This also deletes entries whose value is false, such as '0', as is
> >mentioned in the FAQ you copied this from. Why not simply aim the
> >questioner to the FAQ (as two of us have already), so he can get the
> >whole story?
> >
> >--
> >(Just Another Larry) Rosler
> >Hewlett-Packard Company
> >http://www.hpl.hp.com/personal/Larry_Rosler/
> >lr@hpl.hp.com
>
> Well, excuse the fuck out of me. I didn't realize that the great Larry Rosler
> could see all the way to VA to know where I got that. I pulled it out of a
> piece of code I've been using in project for 2 years. I have no idea where I
> originally got it.
Once again I find myself wishing I could read posts through the same
vomit-coloured glasses that so many others have. Larry said you copied
it from the FAQ and apparently he was mistaken. Could you please
transcribe the part that I can't see where he also insulted you?
Why are you answering FAQs with your own code again?
> Also, dickhead, when I posted my answer no other replies
> had made it to the news service I was looking at. I certainly would have
> never replied had I known the great Larry Rosler would have such a fit.
Larry said that he and someone else already posted a FAQ pointer. Did
he also accuse you of actually seeing this and just ignoring it?
Between which lines is this accusation hidden?
> I have no problem with you correcting the code, since I didn't realized the
> problem, but don't cop such a holier-than-thou attitude. Or are you such an
> asshole all the time?
I have never noticed this but I obviously miss a lot. Or perhaps the
weight of the chip on your shoulder is cutting off circulation to your
brain and making you hallucinate.
Maybe you should remove it before it kills you.
--
Rick Delaney
rick.delaney@shaw.wave.ca
------------------------------
Date: Tue, 26 Jan 1999 19:04:41 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: re: dupes in Perl
Message-Id: <MPG.111822231605ff2f9899ce@nntp.hpl.hp.com>
[Posted and a DIScourtesy copy mailed.]
In article <78loeh$q23$1@nnrp1.dejanews.com> on Wed, 27 Jan 1999
01:00:06 GMT, dturley@pobox.com <dturley@pobox.com> says...
+ Larry Rosler send in email:
+
+ In reply to your message entitled "Re: Deleting dupes with Perl":
+ >[Posted and a courtesy copy mailed.]
+ >
+ >In article <78l8t4$dbh$1@nnrp1.dejanews.com> on Tue, 26 Jan 1999
+ >20:34:45 GMT, dturley@pobox.com <dturley@pobox.com> says...
+ >> In article <78km8q$ss6$1@nnrp1.dejanews.com>,
+ >> jxdub@my-dejanews.com wrote:
+ >> > but now I need to delete the
+ >> > duplicates... Could anyone tell me a good way to do this?
+ >>
+ >> here's one way. put the file into @out, sort it, then print it.
+ >>
+ >> @sorted = sort @out;
+ >> $prev = 'nonesuch';
+ >> @n_out = grep($_ ne $prev && ($prev = $_), @sorted); #remove
duplicates
+ >
+ >This also deletes entries whose value is false, such as '0', as is
+ >mentioned in the FAQ you copied this from. Why not simply aim the
+ >questioner to the FAQ (as two of us have already), so he can get the
+ >whole story?
+ >
+ >--
+ >(Just Another Larry) Rosler
+ >Hewlett-Packard Company
+ >http://www.hpl.hp.com/personal/Larry_Rosler/
+ >lr@hpl.hp.com
+
+ Well, excuse the fuck out of me. I didn't realize that the great Larry
Rosler
+ could see all the way to VA to know where I got that. I pulled it out
of a
+ piece of code I've been using in project for 2 years. I have no idea
where I
+ originally got it.
The code in the FAQ (compare with the code above):
$prev = 'nonesuch';
@out = grep($_ ne $prev && ($prev = $_), @in);
+ Also, dickhead, when I posted my answer no other
replies
+ had made it to the news service I was looking at. I certainly would
have
+ never replied had I known the great Larry Rosler would have such a
fit. I
+ have no problem with you correcting the code, since I didn't realized
the
+ problem, but don't cop such a holier-than-thou attitude. Or are you
such an
+ asshole all the time?
You have such an elegant vocabulary! I leave it to my colleagues in
this newsgroup -- whose judgment and respect mean a great deal to me --
to decide if my comment, which you quote above, deserves this kind of
response.
Others would say PLONK! at this point, but I've never done that and
won't now. Who knows? Some day you may grow up and have something
useful to offer.
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Tue, 26 Jan 1999 20:00:41 -0600
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Help a newbie with a custom shipping script?
Message-Id: <#FCvYjZS#GA.189@news1.texas.rr.com>
In article <78lnsa$pjq$1@nnrp1.dejanews.com>, <mfrey@my-dejanews.com> wrote:
>Have set up a shopping cart for my churches web site and I am trying
>to add a custom shipping script. It works great except when the weight
>is greater than or equal 125 for Canada or Mexico or greater than or
>equal to 100 for all other non-US countries. If you look at the
>script, it seems to ignore my last "else" statement in each section.
>See the comments in the script.
>
>I just started learning Perl last week in order to do this so go easy
>on me. Running Perl -w doesn't give me any real info--I know I'm not
>really using all the variables. What am I really doing wrong?
You might want to read the script carefully and adopt a consistent
indenting style. i
There's a difference between $customShippingCost and
$customerShippingCost and -w will usually warn you if a variable appears
once in a script, but maybe you cut and pasted the Canadian and Mexican
code segments so -w didn't spot the $customerShippingCost as an accident.
In recent perl's it's possible to use a pragma to make perl complain about
variable which you haven't explicitly declared.
Hope this helps,
Mike
if( $totalItems > 0 ) {
if( $country =~ /US/i ) {
if( $totalWeight < 33 ) {
$customShippingCost = 4;
}
else {
$customShippingCost = ((($totalWeight - 32) * .1) + 4);
}
}
elsif( $country =~ /CA/i ) {
if( $totalWeight < 30 ) {
$customShippingCost = 6;
}
elsif( $totalWeight >= 30 && $totalWeight < 125 ) {
$customShippingCost = ($totalWeight * .16);
}
else {
$customerShippingCost = ($totalWeight * .13);
#______^^
}
}
elsif( $country =~ /MX/i ) {
if( $totalWeight < 30 ) {
$customShippingCost = 6;
}
elsif( $totalWeight >= 30 && $totalWeight < 125 ) {
$customShippingCost = ($totalWeight * .26);
}
else {
$customerShippingCost = ($totalWeight * .22 );
#______^^
}
}
else {
if( $totalWeight < 19 ) {
$customShippingCost = 10;
}
elsif( $totalWeight >= 19 && $totalWeight < 100 ) {
$customShippingCost = ($totalWeight * .55);
}
else {
$customerShippingCost = ($totalWeight * .45);
#______^^
}
}
}
else {
$customShippingCost = 0;
}
--
mike@stok.co.uk | The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/ | PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
| 65 F3 3F 1D 27 22 B7 41
stok@colltech.com | Collective Technologies (work)
------------------------------
Date: 26 Jan 1999 18:56:40 -0800
From: Adam Rosenstein <adam@Tut.CS.UCLA.EDU>
Subject: HELP! how to use an IO::Handle as a filehandle (glob ref)
Message-Id: <m3679tfmon.fsf@Tut.CS.UCLA.EDU>
I'm basically a perl5 newbie, so if this is something everyone should
know don't yell at me.
I see plenty of examples on how to get a filehandle from an
IO::Handle if you want to contruct a new IO::Hanlde (i.e. tie), and to
give ordinary filehandles the IO::Handle interface (Wrap, WrapTie,
etc), but can I take an existing IO::Handle and use it like a
filehandle?
Specifically, MIME::Body->open("r") gets me an IO::Handle (IO::Scalar
or IO::File which inherit from IO::Handle, right?) and I want to send
the message through Digest::MD5 which has an 'addfile(\*FILE)' method.
I know I can do
$IO = new IO::Handle;
open($IO,"/tmp/README");
print <$IO>;
close($IO);
showing an IO::Handle working just like a filehandle (its just a ref
to a symbol anyway, right?). but:
$IO = $mimebody->open("r");
print <$IO>;
close($IO);
fails with
Not a GLOB reference
Can somebody please enlighten me? ... The man pages for Tie::Handle,
IO::*, perltie, Symbol, perlfunc and MIME::Body are all starting to
blur together.
--
Adam Rosenstein
adam@cs.ucla.edu
------------------------------
Date: 27 Jan 1999 01:11:23 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: How long would the Unixes last without Perl?
Message-Id: <78lp3r$d5e$1@client2.news.psi.net>
I R A Aggie (fl_aggie@thepentagon.com) wrote on MCMLXXIII September
MCMXCIII in <URL:news:fl_aggie-2501991427590001@aggie.coaps.fsu.edu>:
,, In article <78i4so$o5h$1@client2.news.psi.net>, abigail@fnx.com wrote:
,,
,, + Kent Perrier (kperrier@blkbox.com) wrote on MCMLXXII September MCMXCIII
,,
,, + !! I don't have any experience with HP-UX and I don't consider RedHat a
,, + !! commercial unix.
,,
,, + What's your definition of a commercial Unix then?
,,
,, Something you pay money for and can't download over the net. Last I looked,
,, I could still make my own RH CD's.
,,
,, Solaris would be a good example, tho the academic version is dirt cheap.
Last time I looked, a RH CD with Linux would cost me $79.95 or $65.95,
pretty impressive prices for just the cost of the media. Solaris for
for non-commercial use is available for $10.
Abigail
--
perl -wlne '}{print$.' file # Count the number of lines.
------------------------------
Date: Tue, 26 Jan 1999 21:03:35 -0600
From: mike@stok.co.uk (Mike Stok)
Subject: Re: How long would the Unixes last without Perl?
Message-Id: <#94AiGaS#GA.281@news1.texas.rr.com>
In article <78lp3r$d5e$1@client2.news.psi.net>,
Abigail <abigail@fnx.com> wrote:
>Last time I looked, a RH CD with Linux would cost me $79.95 or $65.95,
>pretty impressive prices for just the cost of the media. Solaris for
>for non-commercial use is available for $10.
Surely you can find it cheaper than that. Cheapbytes has Red Hat for
$1.99, or the official Red Had distribution (which gives you email support
for some period and a printed book to help you get installed and running
and a CD of application samples) for $38.95. If you want a Red Hat
distribution you can pick it up via FTP, or get it at something like the
cost of a CD; if you want to buy the distribution and support then you can
get that.
What's your point?
Mike
--
mike@stok.co.uk | The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/ | PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
| 65 F3 3F 1D 27 22 B7 41
stok@colltech.com | Collective Technologies (work)
------------------------------
Date: Wed, 27 Jan 1999 02:53:26 GMT
From: scraig@my-dejanews.com
Subject: Re: how to return multiple values in perl?
Message-Id: <78lv33$ved$1@nnrp1.dejanews.com>
In article <78l7v7$cge$1@nnrp1.dejanews.com>,
tariq.ahmed@usa.net wrote:
> Hi there.
>
> I want to return multiple values. And for simple types, I have no problem.
> But I want to return a number, hash, and an array.
>
> { # main routine
>
> local %items_hash;
> local @eachline;
> ($a,%items_hash,@eachline)=doit();
> print @eachline;
> print "\n";
> print $items_hash{"a"};
> print "\n$a\n";
> }
>
> sub doit
> {
> local %myhash;
> $myhash{"a"}="b";
> $myhash{"b"}="c";
> @array=("one","two","three");
> return(1,%myhash,@array);
>
> }
>
By placing 1, %myhash, @array in a list context, you get one long list.
1, "a", "b", "b", "c", "one", "two", "three"
or
1, "b", "c", "a", "b", "one", "two", "three"
Assigning the first ( 1 ) to $a leaves an odd number.
All but the last one get assigned in pairs to %items_hash.
That leaves one thing "three" to go in @eachline.
That is $items_hash{"one"} == "two".
Basically, a subroutine can only return one list. But there are ways around
this.
A subroutine can return a list of references ( which are scalars ) to arrays
and hashes. But then the referenced objects have to be global.
It is also possible to mimic C code, where a reference is passed in to the
sub. The sub makes its own copy of the reference and operates on it. But
changes to the referent by the subroutine persist after the sub goes out of
scope.
For example,
{
@array = @array2 = (0,0);
make_arrays(\@array, \@array2);
sub make_arrays {
my ($a, $b) = @_;
@$a = (1,2,3);
@$b = (4,5,6);
}
print @array, @array2, "\n";
}
prints 123456, and not 0000.
HTH
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Tue, 26 Jan 1999 20:16:49 -0600
From: "David Buttrick" <buttrick@sportingnews.com>
Subject: HTML files exported from Quark
Message-Id: <36ae7696.0@news.primary.net>
Hi there.
I am looking to parse some HTML documents.
The documents are structured as one single long line.
The perl that I have written in the past has been very much so line
oriented, and I am not accustomed to thinking about reading a single line
and looking for patterns in it.
I am specifically looking for <table> and </table> tags that will be perhaps
on separate lines. How can I find the <table>, and flag that all the stuff
on that line past the table tag is stuff that I want to load to an array for
later processing, and still maintain that stuff if I'm going to have to read
the next line to find the closing </table>
???
David Buttrick
------------------------------
Date: Tue, 26 Jan 1999 21:22:10 -0500
From: Edan Idzerda <edan@mtu.edu>
Subject: indexing binary data
Message-Id: <36AE7852.468D7A87@mtu.edu>
I had to break down and use C to make this work, but I want to believe
that Perl could do it just as well. I want to be able to read binary
data into an unsigned char buffer, then index it char by char.
In perl, it seems like what I want is close to
read RAWFILE,@buffer,$bufsize;
So that later I can do
syswrite OUTPUT, $buffer[i], 1;
But the input buffer to read() or sysread() has to be a scalar.
Maybe @buffer = <RAWFILE> would work, but my $/ has to be single char,
so that seems no good.
Is that clear enough, and can it be done in Perl? Perhaps this
was a time when 10 lines of C code were the way to go. I'm just
hoping someone will cry "NEVER! Don't be a fool!"
Thanks folks.
- edan
------------------------------
Date: 26 Jan 1999 18:56:30 -0800
From: syran@best.com (Jim Matzdorff)
Subject: Is this possible?
Message-Id: <78lv8u$f4d$1@shell18.ba.best.com>
I have a hash that has subroutine names defined in it (or at least, this
is what I *want* to be able to do)
%subs = (
sub1 => "ThisSub()",
sub2 => "AnotherSub()",
sub3 => "CoolSub()",
sub4 => "NotSoCoolSub()",
)
these subroutines live in files that aren't in main, that are required
into as they are called, or at least that's what I want to do.
For instance, if ThisSub() is in "sub1.pm" then i only want to require
"sub1.pm" if ThisSub() is called. ie:
if ($subs{sub1})
{
require "sub1.pm";
&subs{sub1};
}
Now, to get a little tricker, I also want to have the following hash:
&requires = (
sub1 => "sub1.pm",
sub2 => "sub1.pm",
sub3 => "sub2.pm",
sub4 => "sub2.pm",
)
So now I can say...
if ($subs{sub1})
{
require $requires{sub1};
&subs{sub1}
}
The obvious advantage is (or at least, the one I am trying to obtain) is
to have the hash key be a variable and then I can just call whatever
routine is in that variable, it will require the right file, and run the
right subroutine.
But.... I don't know if I can do this. I believe, no, I know I am lost.
Comments, criticisms, direction?
Cheers,
--jim
--
--
One tequila, two tequila, three tequila, floor.
------------------------------
Date: Wed, 27 Jan 1999 03:42:05 GMT
From: ears@dania.dialisdn.com (Ears)
Subject: Re: Jesus Rides a HOG(tm) : was :CONCLUSIVE PROOF: The Beatles are bigger than Jesus!
Message-Id: <slrn7arot5.1p8.ears@dania.dialisdn.com>
On Wed, 27 Jan 1999 03:11:43 GMT,
Spider Fighter <spiderfighter@REMOVETHISTOEMAILMEhotmail.com> wrote:
>Well, _that_ was interesting.
>Please don't post this thread to the rec.games.video.nintendo newsgroup any more.
OK, consider it done. No longer crossposting there.
BTW, did John Lennon ride a Harley ? Or any other bike, for that matter ?
I'll bet if Harleys were around when Jesus was, he, and all his apostles
would've ridden. Well, they did say he could see the future....
BTW, this thread is no longer being posted to rec.games.video.nintendo.
If you don't want this posted to your newsgroup either, reply to us here
at rec.motorcycles.harley, and we will be glad to take it out of the
header for you. Unless of course, you're smart enough to do it yourself
before you repost.
This thread is currently being maintained by bonafide Harley riders now.
--
*Ears* 98 XL 1200 Custom
kd4zkw@amsat.org
http://www.dialisdn.net/user/cdlevin
------------------------------
Date: 27 Jan 1999 01:24:14 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Number manipulation and time formats
Message-Id: <78lpru$d5e$2@client2.news.psi.net>
End User (kimntodd@dontspamus.execpc.com) wrote on MCMLXXIV September
MCMXCIII in <URL:news:78l6na$j98$1@news1-alterdial.uu.net>:
..
.. My question is how to easily convert the 3 into 03. Is there something that
.. I can perform on the $d to determine if it is <10, change the format?
printf
Abigail
--
perl -we '$_ = q ?4a75737420616e6f74686572205065726c204861636b65720as?;??;
for (??;(??)x??;??)
{??;s;(..)s?;qq ?print chr 0x$1 and \161 ss?;excess;??}'
------------------------------
Date: Wed, 27 Jan 1999 03:29:20 GMT
From: expoinfo@globalexpos.co.nz
Subject: Perl print ("....."); command problems
Message-Id: <78m167$13h$1@nnrp1.dejanews.com>
Hullo... :o)
I am currently having a problem with a script..
It is to be installed onto a Unix Server, yet this part of teh script is
bothering me when porting from Win32 to Unix.
print qq!
<table border=0 width=550><tr><td valign=top width=450>
!;
I dont seem to be able to change it to the ...
print ("<table border=0 width=550><tr><td valign=top width=450>");
.. and have it still work
WHAT IS THE PROBLEMO :oP
Thanksya
Andrew
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Tue, 26 Jan 1999 19:36:08 -0800
From: Bruce McEachern <brucem@library.ucdavis.edu>
To: fooly@sztaki.hu
Subject: Re: perlcc problem (some compilled programs doesn't running)
Message-Id: <36AE89A8.7C78@library.ucdavis.edu>
Pal,
I tried your little script on my own machine (SPARC Sol2.5/Perl5.005_02)
and the perlcc generated a `damn fine cat'.
However, "Modification of a read-only value attempted at test.pl line
2."
looks strangely reminiscent of the error I had when I tried to perlcc a
script which had a variable named "key" localized in a function. Seems
perlcc was creating a temporary file in the compilation process which
had a small stub of code prepended. In this code (20 lines at most, as
I recall) was the declaration:
:
my key;
:
With no "_" prepended or nothin'! (Bad form, IMHO, but I just changed my
definition to "Key".)
In order to find this out I had to take a look at the temporary which
was getting stored in /tmp/ on my machine (and to do this I had to run
a perlcc in debug mode so I could exit before the file was wiped out).
Perhaps something similar is happening to you.
Good luck,
Bruce
--------------------------------------------------------------------
Bruce McEachern >> brucem@library.ucdavis.edu <<
Library Systems Department The older I get, the better I...was.
Univ. of California, Davis Youth is fleeting
Phone: (530) 752-7685 --immaturity can last a lifetime.
--------------------------------------------------------------------
> Fulajtar Pal wrote:
> :
> ----------------------------
> #!/usr/bin/perl
> while(<>)
> {
> print $_;
> }
> ----------------------------
> The compillation (perlcc test.pl) was succesfull (without any warning or
> erorr), but when I started this compilled program with a parameter
> (example: test /etc/sendmail.cf) the program give me the following
> message:
> "Modification of a read-only value attempted at test.pl line 2."
> , but when I running the original perl script (without compilation) the
> progam runs ok.
> :
------------------------------
Date: Tue, 26 Jan 1999 13:18:17 -0500
From: John Chambers <jc@uwm-dev.gte.com>
Subject: perlipc examples fail with WebSTAR server
Message-Id: <36AE06E9.617614AC@uwm-dev.gte.com>
Some poor misguided souls that I'm working with are running the WebSTAR
web server on their Macintoshes, and while it seems to work ok with the
common browsers, and I can even telnet to its port 80 and type the usual
GET commands, nonetheless all of my perl web-access programs fail utterly
when talking to this server. They simply hang, and don't even get the
HTTP headers, much less any data.
Thinking it was my own code's fault, I started grabbing other tools,
such as the GET program than comes with LWP, and also the examples in
the perlipc man page. None of them work. They all hang. What the
perlipc examples do with -dw is instructive: When they get to the
while loop to read from the socket, they simply skip over it. The
debugger's s command acts like the input loop simply doesn't exist,
doesn't show it to me, doesn't ask me if I want to do it, but just
skips over it and shows me the close command. When I step into the
close command, it hangs indefinitely.
But telnet, Netscape and IE all connect just fine and get data.
Any idea what these programs know that perl's socket library doesn't?
It'd sure be nice to be able to run perl programs like GET against
this server.
(Digging around in TFFAQ and DejaNews didn't turn up anything that
seemed to be the least bit relevant to this.)
------------------------------
Date: Tue, 26 Jan 1999 20:54:04 -0500
From: "Robert Gwynne" <gwynne@utkux.utk.edu>
Subject: Re: Pleeeeeassee help!!!
Message-Id: <78lro1$36h$1@gaia.ns.utk.edu>
See the FAQ: "How do I remove HTML from a string?"
The most correct way (albeit not the fastest) is to use HTML::Parse from
CPAN (part of the libwww-perl distribution, which is a must-have module for
all web hackers).
For the second part, read up on process management in Perl 5 Interactive
Course.
See "Reading or Writing to Another Program" in Perl Cookbook.
See Chapter 3 Programming Perl
Read Chapter 14 "Process Management" in Learning Perl.
Read the FAQ and docs and invest in the above books.
Hope this saves your ass.
---------------------------
Bob Gwynne
gwynne@utkux.utk.edu
Speech Comm
University of Tennessee, Knoxville
JAPN (Just Another Perl Newbie)
Ivan Pantophlet <fletdog@bellatlantic.net> wrote in message
news:78gv9o$rj6@world6.bellatlantic.net...
>How can I lift a number from an html document that was returned from a cgi
>script and post it to a whole other apple soft script somewhere else? Case
>in point:
>
>I have a shopping cart that returns a html document that displays a grand
>total of a purchase. I want to somehow take that total figure that was
>returned and send it to a credit card script for veification and
>processing. I was told that I would have to create a script to parse the
>document and sent it that way.....man I don't know what the heck to do. I
>just wish I could get some help with this.
>
>fletdog@bellatlantic.net
>
>
------------------------------
Date: Wed, 27 Jan 1999 03:08:20 +0100
From: Staffan Liljas <staffan@ngb.se>
Subject: Re: Regex for splitting this...
Message-Id: <36AE7514.CB6E78AF@ngb.se>
Hi!
You need to remember if you're on the second line of the error message.
Do:
foreach $file (@files) {
open(IN, $file) or die "Error opening $file : $!\n";
LINE: while (<IN>) {
if ($secondline){
($text) = /"([^"]+)"/; # text gets the first thing
# between quotes.
print OUT "Text: " . $text . "\n";
$secondline = 0;
next LINE;
}
next LINE unless /LogMessage/; # I assume this exists only
# on the apropriate lines.
($code) = /"([^"]+)"/;
($text) = /, *"([^"]+)"/; # Note the comma.
$secondline = 1 unless /;\s*$/; # If we haven't got a semicolon
# on the end of the line,
# we should expect more.
print OUT "Code: " . $code . "\n";
print OUT "Text: " . $text . "\n" unless $secondline;
}
This should work.
Note the [^"]. Read perlre to see what it means.
Staffan
------------------------------
Date: Tue, 26 Jan 1999 20:09:27 -0600
From: Rahul K <rahulk@iname.com>
Subject: split file into multiple...
Message-Id: <36AE7557.D1F31E3C@iname.com>
Hi,
I have a file that contains *binary data*. The data is such that it
contains repetitions of a string , say xoox. I want to split this file
at this string into multiple files.
ie lets say my binary file contained
xoox11111xoox22222xoox33333xoox44444
after running the program, I will have four files which contain
xoox11111
xoox22222
xoox33333
xoox44444
Thanks in advance,
-rahul
------------------------------
Date: Tue, 26 Jan 1999 22:23:23 -0500
From: Jeff Hester <jeff@toad.net>
Subject: system function, Pros and Cons??
Message-Id: <36AE86AB.BDE71493@toad.net>
I'm reposting this do to errors I received the first time. Hopefully
I'm not doubling up the posts (if so except my apologies before hand)
--------- Begin Included File --------------
I have just recently begun my perl education. My first task was a
formatter for the output from "prex -k" in Solaris 2.6. also a little
hexadecimal conversion thingy (that's not quite working yet :)).
A coworker of mine (who is a much more experienced perl person than
myself) Took a look at it and informed me that I "Should never use
system()". I called allot of unix commands through this and they seemed
to work just fine. Unfortunately he couldn't give me a good reason why
I shouldn't use that function.
Does anyone know if "system" is faulty in some way? why would you not
want to use it???
------------------------------
Date: Wed, 27 Jan 1999 03:19:11 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: tryin' to learn
Message-Id: <36AE8787.DC39495D@home.com>
[posted & mailed]
root wrote:
>
> format not terminated ...
> format not terminated ...
> execution aborted ...
All Perl errors are documented in the perldiag page. Here's the entry
for this:
Format not terminated
(F) A format must be terminated by a line with a solitary dot. Perl
got to the end of your file without finding such a line.
If that's not clear, it simply means that there should be no spaces
after the dot, just a newline.
--
Rick Delaney
rick.delaney@shaw.wave.ca
------------------------------
Date: Tue, 26 Jan 1999 14:30:34 -0500
From: John Chambers <jc@uwm-dev.gte.com>
Subject: Re: using # as literal '#' in a cgi
Message-Id: <36AE17DA.176753BD@uwm-dev.gte.com>
schmale@my-dejanews.com wrote:
>
> I have written a CGI script in perl and recieve input in the following manner:
>
> http://..../cgi/test?f=index.html#mydog
>
> now, the problem is that $ENV{QUERY_STRING} only contains:
>
> f=index.html
>
> when I want to have:
>
> f=index.html#mydog
>
> Is there anyway to accomplish this?
Unfortunately, this is the way it's supposed to work. The
"#mydog" portion is normally handled by the browser, and is
not sent to the web server. The browser fetches the entire
document, and then positions the window so that the "mydog"
line is showing.
This is probably in some HTML or CGI FAQ somewhere ...
If you want the browser to handle the # normally, and also
send it to your script, maybe what you need to do is
to replicate the string before the #; something like:
http://..../cgi/test?f=index.html&x=mydog#mydog
It's a few more bytes, but it would get the info across
to your script.
------------------------------
Date: 12 Dec 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 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
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 4757
**************************************