[20011] in Perl-Users-Digest
Perl-Users Digest, Issue: 2206 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Nov 26 09:05:52 2001
Date: Mon, 26 Nov 2001 06:05:12 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <1006783512-v10-i2206@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Mon, 26 Nov 2001 Volume: 10 Number: 2206
Today's topics:
Re: [Newbie] Iterating through dirs recursively <comdog@panix.com>
Re: A Perl Bug? <jake@chaogic.com>
Re: A Perl Bug? <jake@chaogic.com>
Re: A Perl Bug? <edgue@web.de>
Re: A Perl Bug? <mgjv@tradingpost.com.au>
Re: A Perl Bug? <joe+usenet@sunstarsys.com>
Re: A Perl Bug? <joe+usenet@sunstarsys.com>
Re: A Perl Bug? <jake@chaogic.com>
Re: A Perl Bug? <jake@chaogic.com>
Array from a hash <blnukem@hotmail.com>
Re: Array from a hash <admin@asarian-host.net>
Re: Array from a hash <admin@asarian-host.net>
Re: Array from a hash <bernard.el-hagin@lido-tech.net>
Re: Array from a hash <blnukem@hotmail.com>
Re: Array from a hash <bernard.el-hagin@lido-tech.net>
call-by-reference, no newbie question martin@unix-ag.org
Re: call-by-reference, no newbie question (Rafael Garcia-Suarez)
Re: call-by-reference, no newbie question <bernard.el-hagin@lido-tech.net>
Calling C executable from perl (anirban chakraborti)
Re: Calling C executable from perl <Tassilo.Parseval@post.rwth-aachen.de>
Re: Can I avoid 2 passes? <nilram@boisdarc.tamu-commerce.edu>
Re: Can I avoid 2 passes? <mgjv@tradingpost.com.au>
changing a html page for printing <lex@nospam.peng.nl>
Re: changing a html page for printing <brian.norman@gecm.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 26 Nov 2001 02:21:26 -0600
From: brian d foy <comdog@panix.com>
Subject: Re: [Newbie] Iterating through dirs recursively
Message-Id: <comdog-8AD00E.02212626112001@news.panix.com>
In article <9tsrs4$b78$1@news.att.net.il>, "Assaf Lavie"
<assafl@flashnetworks.com> wrote:
> I still havn't figured out how to return to the original WD after I change
> it using chdir. How do I retrieve the current working directory?
before you chdir(), save the current working directory. you can
use Cwd.pm for that.
--
brian d foy <comdog@panix.com> - Perl services for hire
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html
------------------------------
Date: Mon, 26 Nov 2001 03:14:19 -0600
From: "Jake Fan" <jake@chaogic.com>
Subject: Re: A Perl Bug?
Message-Id: <9tt168$ajo$1@Masala.CC.UH.EDU>
Looks like my attempt at not starting a flame war has failed miserably. You
can always tell from miles away that a thread has degenerated into a flame
war just by looking at the shape of the thread (assuming your software has
the thread indenting feature). It never fails.
> rtfm. this is not a helpdesk. it is a discussion group on perl. you are
This *is a helpdesk, among other things. I asked for help on a problem, you
and others provided answers, and I said "thank you for your help". Simple
as that. Next time, I myself could help out on other people's problems.
This is the way it's supposed to work.
BTW (that's "By The Way", by the way), what is rtfm? (FYI, it's "Read The
Fucking Manual".) You think that's not annoying to people who prefer not to
use all the nonsensical acronyms all the time? "easy for you is annoying
for others", talk about hypocrisy.
Not trying to be personal. People with vastly different backgrounds and
motivations use Perl for different purposes, which is one of the greatest
things about Perl. Many people only want to get things done and couldn't
care less about the language itself, which is perfectly acceptable. On the
other hand, there is a group of people who treat Perl as the way of life,
achieving technical excellence in this area and representing the active
driving force behind the language, which is certainly admirable. However,
technical excellence does not give one rights to impose his/her own way of
life on others. I wouldn't say it's prevalent, but this God complex does
happen more often than not in the technical circle, sometimes even to the
greatest achievers. The GNU/Linux fiasco is a perfect example.
When I encounter people with God complex, I learn from their
knowledge/experiences, and ignore their attitude. Heck, occasionally I
myself develop God complex when situation arises (after all, we are all
humans), and usually get promptly treated the same way by other people.
Why? Who gives a damn?
------------------------------
Date: Mon, 26 Nov 2001 03:53:41 -0600
From: "Jake Fan" <jake@chaogic.com>
Subject: Re: A Perl Bug?
Message-Id: <9tt3g3$b1v$1@Masala.CC.UH.EDU>
> If you don't believe that it's standard, go to
> http://groups.google.com/ , pick a few random newsgroups, and
> browse through some articles from several years ago. You'll
> find that top-posting was essentially non-existent back then,
> and it's only relatively recently with the mass influx of new
> people that top-posting has started to happen on Usenet.
>
Standard? Maybe we should all stick to Perl 1.0, which was the standard
many years ago? Why GUI, since CLI was the standard for a long time in
computing history? Heck, why computer at all, as paper and pencil used to
be the standard, and still is in most part of the world... The point is,
things change, and standards change accordingly. Standards are created to
serve people, not restrict people. If their is a mass influx of new people
who prefer not to do things the old way, is it possible that there is
something not quite right with the standard (not intuitive, not convenient)?
Perhaps we need to start considering upgrading the standard?
------------------------------
Date: Mon, 26 Nov 2001 11:32:53 +0100
From: Edwin =?iso-8859-1?Q?G=FCnthner?= <edgue@web.de>
Subject: Re: A Perl Bug?
Message-Id: <3C021A55.2B2F4FBA@web.de>
Jake Fan wrote:
> Standard? Maybe we should all stick to Perl 1.0, which was the standard
> many years ago? Why GUI, since CLI was the standard for a long time in
I think you are wrong for a number of reasons:
- It is your decision to use Perl 1.0, Perl 4 or Perl 5.7.2. It doesnt
affect other people in any way. But your posting style affects other
people. The majority of people decided: we dont want top postings.
If people can't live with that - nobody hinders them to create
comp.lang.perl.top-posters-only.
It might just happen that none of the gurus will read / respond to
questions in that group ...
- If people stop to use perl x and switch to perl y - they have only
one reason: perl y might be better than perl x.
Perl 5.6 is the standard, because its better than Perl 1.
Perl 6 might be standard in 5 years, because it will be (hopefully)
better than Perl 5.6
But I can't see any advantages of top postings. This concept
has / is / and will always be the weaker one. You see - just because
everything changes it is not necessary to throw away the good
rules (that proved to be good over years).
> things change, and standards change accordingly. Standards are created to
> serve people, not restrict people. If their is a mass influx of new people
Exactly. And "top posting" is not the standard because its the weaker
way of providing information. And by the way: it is just plain impolite
(IMHO). If you write something, you want others to spend their time
to read it. So it is YOUR job to provide your information in the best
way - in the way that makes it easy for your reader to see your point.
Top-Posting forces the reader to constantly switch between your text
and the quoted text. They put the workload on the reader ...
- "normal posting style":
one person (author) needs to spent a hard time on doing a good job
many many people have an easy job to read ...
- top style posting:
one person (author) has an easy job to do
many many people need to spent much more time on reading and figuring
out the logical bridges between new and quoted material
> who prefer not to do things the old way, is it possible that there is
> something not quite right with the standard (not intuitive, not convenient)?
> Perhaps we need to start considering upgrading the standard?
Just try it. The majority will not follow you. They will simply ignore
you and in the end, nobody will quote your text - because nobody
is going to read ...
Maybe I am wrong. But I doubt it.
------------------------------
Date: Mon, 26 Nov 2001 21:43:41 +1100
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: A Perl Bug?
Message-Id: <slrna0476t.ghk.mgjv@martien.heliotrope.home>
On Mon, 26 Nov 2001 03:14:19 -0600,
Jake Fan <jake@chaogic.com> wrote:
> Looks like my attempt at not starting a flame war has failed miserably.
Odd. I only see behaviour on your part that is certain to provoke a
flame war.
*plonk*
Martien
--
Do not pay any attention to what Godzilla says. It is a troll, and has
no decent working knowledge of Perl or programming in general. Search
groups.google.com to see a history of its posts and replies to these posts.
------------------------------
Date: 26 Nov 2001 07:13:26 -0500
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: A Perl Bug?
Message-Id: <m3zo59687t.fsf@mumonkan.sunstarsys.com>
Uri Guttman <uri@stemsystems.com> writes:
> >>>>> "JF" == Jake Fan <jake@chaogic.com> writes:
>
> JF> Thanks for the tutorial link. I was only partially and vaguely
> JF> aware of the autovivification issue, now things are much clearer.
> JF> But still, why "$x[0] ||= ..." autovivifies, while "$x[0] = $x[0]
> JF> || ..." doesn't? Does not seem consistent.
>
> because of the way it is implemented. ||= is set up to be faster than
> the expanded version as well as more succinct. the compiler knows more
> about the actual code with ||= and can do optimizations like
> autovivifying first. with the full expression it has to do much more
> analysis to get the same effect.
Here's what
% perl -Dt -e 'EXPR' ARG
had to say:
EXPR '$ARGV[0] ||= $ARGV[0]' '$ARGV[0] = $ARGV[0] || @ARGV[0]'
-------------------------------------------------------------------
no ARG
aelemfast aelemfast
orassign or
gv(main::ARGV) gv(main::ARGV)
rv2av rv2av
sassign aelemfast
sassign
ARG = 1
aelemfast aelemfast
orassign or
aelemfast
sassign
It looks like the big win is when ||= is basically a noop; note
that there is no "sassign" operation taking place then (which is
likely the most expensive operation here).
--
Joe Schaefer "The way to get rid of temptation is to yield to it."
-- Oscar Wilde
------------------------------
Date: 26 Nov 2001 07:24:16 -0500
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: A Perl Bug?
Message-Id: <m3vgfx67pr.fsf@mumonkan.sunstarsys.com>
Joe Schaefer <joe+usenet@sunstarsys.com> writes:
> Here's what
> % perl -Dt -e 'EXPR' ARG
> had to say:
>
> EXPR '$ARGV[0] ||= $ARGV[0]' '$ARGV[0] = $ARGV[0] || @ARGV[0]'
^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Sorry- bad editing. This line should read
EXPR '$ARGV[0] ||= @ARGV' '$ARGV[0] = $ARGV[0] || @ARGV'
> -------------------------------------------------------------------
> no ARG
> aelemfast aelemfast
> orassign or
> gv(main::ARGV) gv(main::ARGV)
> rv2av rv2av
> sassign aelemfast
> sassign
>
> ARG = 1
>
> aelemfast aelemfast
> orassign or
> aelemfast
> sassign
>
> It looks like the big win is when ||= is basically a noop; note
> that there is no "sassign" operation taking place then (which is
> likely the most expensive operation here).
Hope that's less confusing now.
--
Joe Schaefer "A man cannot be too careful in the choice of his enemies."
--Oscar Wilde
------------------------------
Date: Mon, 26 Nov 2001 07:03:59 -0600
From: "Jake Fan" <jake@chaogic.com>
Subject: Re: A Perl Bug?
Message-Id: <9ttekt$bf4$1@Masala.CC.UH.EDU>
> (IMHO). If you write something, you want others to spend their time
> to read it. So it is YOUR job to provide your information in the best
> way - in the way that makes it easy for your reader to see your point.
Exactly. IMHO, the best way to write a post, is not to quote anything at
all. When you reply to a letter in real life, do you pick the original
letter apart, make verbatim copy of various sentences and paragraphs, and
then make comments beneath each one of them? Probably you don't. It would
make your reply look like incoherent graffiti. Instead, you take your time,
and write your reply in one coherent and complete essay. When quoting is
really needed, you try to incorporate it seamlessly into your own sentences
and paragraphs.
Of course, Usenet changed all that (which is not necessary a bad thing), and
spawned this ridiculous and eternal debate on "posting style". Check out
the link at the bottom of this message if you really want to see my point.
> You see - just because everything changes it is not necessary to throw
> away the good rules (that proved to be good over years).
You see, the Usenet style of writing is not necessary good rules. It could
certainly use some improvements. Many people are probably too accustomed to
the "normal" interleaved posting style to realize its peculiarities. Plus,
things have changed drastically in the recent years. Again, see the link
below.
http://paradise.svec.uh.edu/Usenet_Posting_Style.html
------------------------------
Date: Mon, 26 Nov 2001 07:19:08 -0600
From: "Jake Fan" <jake@chaogic.com>
Subject: Re: A Perl Bug?
Message-Id: <9ttfhb$bfu$1@Masala.CC.UH.EDU>
Martien Verbruggen <mgjv@tradingpost.com.au> wrote:
> Odd. I only see behaviour on your part that is certain to provoke a
> flame war.
Which behavior, can you be more specific? General accusation without
reasoning is often one of the causes for flame wars.
BTW, I only joined the war after it started. It's been entertaining.
------------------------------
Date: Mon, 26 Nov 2001 12:33:44 GMT
From: "Blnukem" <blnukem@hotmail.com>
Subject: Array from a hash
Message-Id: <IEqM7.103259$636.13640735@news02.optonline.net>
Hi Group
I need some help I call this array from a hash and I get a bunch of commas
"," in the output what is the best solution to stop this?
Here is my code:
foreach $key ( sort{ $a <=> $b } %GRADETEST ){
push ( @USRANWSERS, $GRADETEST{$key});
}
foreach (@USRANWSERS){
($questnumber,$questionanswer) = split(/\|/);
print "Content-type: text/html\n\n";
print "$questnumber $questionanswer<br>";
}
------------------------------
Date: Mon, 26 Nov 2001 13:17:18 GMT
From: "Mark" <admin@asarian-host.net>
Subject: Re: Array from a hash
Message-Id: <yhrM7.56983$8q.9460079@bin2.nnrp.aus1.giganews.com>
"Blnukem" <blnukem@hotmail.com> wrote in message
news:IEqM7.103259$636.13640735@news02.optonline.net...
> Hi Group
>
> I need some help I call this array from a hash and I get a bunch
> of commas "," in the output what is the best solution to stop this?
>
> Here is my code:
>
> foreach $key ( sort{ $a <=> $b } %GRADETEST ){
> push ( @USRANWSERS, $GRADETEST{$key});
> }
Hmm, should you not be saying something like "foreach ... keys %GRADETEST"?
Because of you ommit "keys", ya just get the "values"; and your code seems
to indicate you want the keys.
- Mark
------------------------------
Date: Mon, 26 Nov 2001 13:30:15 GMT
From: "Mark" <admin@asarian-host.net>
Subject: Re: Array from a hash
Message-Id: <HtrM7.126388$dk.9534045@bin1.nnrp.aus1.giganews.com>
"Mark" <admin@asarian-host.net> wrote in message
news:yhrM7.56983$8q.9460079@bin2.nnrp.aus1.giganews.com...
> "Blnukem" <blnukem@hotmail.com> wrote in message
> news:IEqM7.103259$636.13640735@news02.optonline.net...
>
> > Hi Group
> >
> > I need some help I call this array from a hash and I get a bunch
> > of commas "," in the output what is the best solution to stop this?
> >
> > Here is my code:
> >
> > foreach $key ( sort{ $a <=> $b } %GRADETEST ){
> > push ( @USRANWSERS, $GRADETEST{$key});
> > }
>
> Hmm, should you not be saying something like "foreach ...
> keys %GRADETEST"? Because of you ommit "keys", ya just get the
> "values"; and your code seems to indicate you want the keys.
Actually, let me formulate correctly: you get the keys + values, to be
precise; first the key, then the value, alternating. And your code seems to
want just the keys.
- Mark
------------------------------
Date: 26 Nov 2001 13:00:49 GMT
From: Bernard El-Hagin <bernard.el-hagin@lido-tech.net>
Subject: Re: Array from a hash
Message-Id: <slrna04i5i.qsr.bernard.el-hagin@gdndev25.lido-tech>
On Mon, 26 Nov 2001 12:33:44 GMT, Blnukem <blnukem@hotmail.com> wrote:
> Hi Group
>
> I need some help I call this array from a hash and I get a bunch of commas
> "," in the output what is the best solution to stop this?
Ummm, do you think that maybe a sample of the input data
would help us help you?
Cheers,
Bernard
------------------------------
Date: Mon, 26 Nov 2001 13:19:09 GMT
From: "Blnukem" <blnukem@hotmail.com>
Subject: Re: Array from a hash
Message-Id: <hjrM7.104076$636.13710250@news02.optonline.net>
Input Sample:
1| awnser
2|awnser
3|awnser
4|awnser
------------------------------
Date: 26 Nov 2001 13:38:24 GMT
From: Bernard El-Hagin <bernard.el-hagin@lido-tech.net>
Subject: Re: Array from a hash
Message-Id: <slrna04kc1.qsr.bernard.el-hagin@gdndev25.lido-tech>
On Mon, 26 Nov 2001 13:19:09 GMT, Blnukem <blnukem@hotmail.com> wrote:
> Input Sample:
>
> 1| awnser
> 2|awnser
> 3|awnser
> 4|awnser
What kind of data structure is that? Are those the values of your
hash? The keys? Please post the entire relevant snippet of code
which is troubling you. The problem is in the foreach loop which
loops through the hash, but the solution depends on the hash you're
reading the data from and we can't help you until you show us that hash.
Cheers,
Bernard
------------------------------
Date: 26 Nov 2001 13:25:10 +0100
From: martin@unix-ag.org
Subject: call-by-reference, no newbie question
Message-Id: <3c0234a5@si-nic.hrz.uni-siegen.de>
Hello,
after multiple reading of the perl* man pages, i still have
no solution to my problem, to write a sub with
call-by-reference in an elegant fashion, here an example,
how it works, but dosen't please me
-- BEGIN
#!/usr/bin/perl -w
use strict;
sub alter ($) {
$_[0]= $_[0] . " blub";
}
my $s= "bla";
alter( $s );
print "$s\n";
-- END
gives the output: "bla blub"
In effect what i want to have, but my sub is more
complex and i use $_[0] a lot, where i've got to my problem
by now. I want to give the variable / scalar which i
use / modify in the sub a reasonable name and don't want to
handle with $_[0] all the time. ok, we have these
references in perl, using them it can be done like this:
sub alter2 ($) {
my $t= \$_[0];
$$t= $$t . " blub";
}
same effect, but now i have to deal with $$t, i.e.
de-refrencing $t all the time. What am i to to, if i want
to work with a plain variable / skalar:
sub alter3 ($) {
my $t= ???;
$t= $t . " blub";
}
where the whole thing still should use call-by-reference,
i.e. if i assign something to $t, $_[0] changes and
therefore $s with which i called the sub. Is this possible
anyway? In principle i want to have an alias to $_[0],
i can't imagine there is no way of achieving it.
Thanks for your attention
and i'm hoping to get interesting tips :)
------------------------------
Date: 26 Nov 2001 12:47:45 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: call-by-reference, no newbie question
Message-Id: <slrna04eh7.qbd.rgarciasuarez@rafael.kazibao.net>
martin@unix-ag.org wrote in comp.lang.perl.misc:
}
} after multiple reading of the perl* man pages, i still have
} no solution to my problem, to write a sub with
} call-by-reference in an elegant fashion, here an example,
} how it works, but dosen't please me
}
} -- BEGIN
} #!/usr/bin/perl -w
}
} use strict;
}
} sub alter ($) {
} $_[0]= $_[0] . " blub";
} }
}
} my $s= "bla";
}
} alter( $s );
} print "$s\n";
} -- END
}
} gives the output: "bla blub"
}
} In effect what i want to have, but my sub is more
} complex and i use $_[0] a lot, where i've got to my problem
} by now. I want to give the variable / scalar which i
} use / modify in the sub a reasonable name and don't want to
} handle with $_[0] all the time. ok, we have these
} references in perl, using them it can be done like this:
}
} sub alter2 ($) {
} my $t= \$_[0];
} $$t= $$t . " blub";
} }
You could use the \$ prototype, that generates a reference in @_ :
sub alter (\$) {
my $t = shift;
$$t .= " blub";
}
alter $s;
} same effect, but now i have to deal with $$t, i.e.
} de-refrencing $t all the time. What am i to to, if i want
} to work with a plain variable / skalar:
}
} sub alter3 ($) {
} my $t= ???;
} $t= $t . " blub";
} }
}
} where the whole thing still should use call-by-reference,
} i.e. if i assign something to $t, $_[0] changes and
} therefore $s with which i called the sub. Is this possible
} anyway? In principle i want to have an alias to $_[0],
} i can't imagine there is no way of achieving it.
Aliasing :
sub alter (\$) {
no strict "vars"; # strictures won't allow this !
my $r = shift; # reference on $s
*t = $r; # alias $t to $s
$t .= " blub"; # and modify $s by side-effect
}
alter $s;
Note that this is not considered good programming practice, unless you
have a very good reason to do so.
--
Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/
Owner: There, he moved!
Customer: No, he didn't, that was you hitting the cage!
-- Monty Python, The Pet Shop
------------------------------
Date: 26 Nov 2001 12:58:53 GMT
From: Bernard El-Hagin <bernard.el-hagin@lido-tech.net>
Subject: Re: call-by-reference, no newbie question
Message-Id: <slrna04i1u.qsr.bernard.el-hagin@gdndev25.lido-tech>
On 26 Nov 2001 13:25:10 +0100, martin@unix-ag.org <martin@unix-ag.org> wrote:
> Hello,
>
> after multiple reading of the perl* man pages, i still have
> no solution to my problem, to write a sub with
> call-by-reference in an elegant fashion, here an example,
> how it works, but dosen't please me
Here is a way which I DON'T RECOMMEND:
sub alter (\$){
no strict 'vars';
my $var = shift;
*t = $var; # perldoc perldata for more info
$t .= ' blub';
}
my $s = 'bla';
alter ($s);
print "$s\n";
Cheers,
Bernard
------------------------------
Date: 26 Nov 2001 03:36:41 -0800
From: anirbanchakraborti@hotmail.com (anirban chakraborti)
Subject: Calling C executable from perl
Message-Id: <c3b9937a.0111260336.6ce0fa43@posting.google.com>
HI,
I am trying to call a c executable from Perl program.The executable
takes a unsigned integer as an argument and doesnot share data with
the calling program.
How to do this on windows platform?
for example
the executable argument
edf.exe -7
from the program a.pl
Please help
Anir
------------------------------
Date: Mon, 26 Nov 2001 13:13:03 +0100
From: "Tassilo v. Parseval" <Tassilo.Parseval@post.rwth-aachen.de>
Subject: Re: Calling C executable from perl
Message-Id: <9ttbkf$v8q$05$1@news.t-online.com>
On 26 Nov 2001 03:36:41 -0800, anirban chakraborti wrote:
> HI,
> I am trying to call a c executable from Perl program.The executable
> takes a unsigned integer as an argument and doesnot share data with
> the calling program.
> How to do this on windows platform?
It is actually quite irrelevant whether the program in question had been
written in C, in LISP or in Plan-Kalkuel. Depending on what the program
you want to call does or return, you have several constructs by your
hand.
'perldoc -f system'
'perldoc -f exec'
and the bits about backticks and qx() in 'perldoc perlop' will tell you
more about that.
> for example
> the executable argument
> edf.exe -7
> from the program a.pl
Wildly guessing, I'd say you want something like:
system 'edf.exe -7';
Tassilo
--
$you = new YOU;
honk() if $you->love(perl)
-- Seen on Slashdot
------------------------------
Date: 26 Nov 2001 03:47:26 -0600
From: Dale Henderson <nilram@boisdarc.tamu-commerce.edu>
Subject: Re: Can I avoid 2 passes?
Message-Id: <87snb1lv81.fsf@camel.tamu-commerce.edu>
>>>>> "Godzilla!" == Godzilla! <godzilla@stomp.stomp.tokyo> writes:
Godzilla!> Dale Henderson wrote:
>> So what's the difference between a hash and and associative
>> array?
Godzilla!> My suggestion is you research and read about arrays and
Godzilla!> hashes. It is clear you have a bit of Perl learning
Godzilla!> yet to accomplish; differences between arrays and
Godzilla!> hashes, are readily apparent.
Actually, I've programmed perl for a number of years and even did
it professionally for a while.
My intent in asking this question was to find out what you
thought the difference between and _associative_ array and hash
was. As the terms are used interchangeably by most perl
programmers.
Notice that I did not respond with: "Associative
arrays and Hashes are the same thing. You obviously need to learn
more about perl." Instead I asked for clarification of the point
you were trying to make.
I've the other posts you've made in this thread and you still
haven't given a clear answer to the question I posed above. Only
vague allusions. The nearest I can come up with is that you may
mean something similar to a lisp alist i.e.:
@alist=(['key1','value1'],['key2','value2']);
But that would be less efficient than a hash.
--
Dale Henderson
"Imaginary universes are so much more beautiful than this stupidly-
constructed 'real' one..." -- G. H. Hardy
------------------------------
Date: Mon, 26 Nov 2001 22:30:36 +1100
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: Can I avoid 2 passes?
Message-Id: <slrna049us.ghk.mgjv@martien.heliotrope.home>
On 26 Nov 2001 03:47:26 -0600,
Dale Henderson <nilram@boisdarc.tamu-commerce.edu> wrote:
>>>>>> "Godzilla!" == Godzilla! <godzilla@stomp.stomp.tokyo> writes:
>
> Godzilla!> Dale Henderson wrote:
> >> So what's the difference between a hash and and associative
> >> array?
>
> Godzilla!> My suggestion is you research and read about arrays and
> Godzilla!> hashes. It is clear you have a bit of Perl learning
> Godzilla!> yet to accomplish; differences between arrays and
> Godzilla!> hashes, are readily apparent.
>
> Actually, I've programmed perl for a number of years and even did
> it professionally for a while.
You obviously don't know Godzilla yet. Ignore anything it says. See
signature and Google for reasons why. It is pointless to get into
discussions with it, as you should have guessed from the response you
got, and that other posts in this thread got.
Martien
--
Do not pay any attention to what Godzilla says. It is a troll, and has
no decent working knowledge of Perl or programming in general. Search
groups.google.com to see a history of its posts and replies to these posts.
------------------------------
Date: Mon, 26 Nov 2001 13:17:22 +0100
From: Lex Thoonen <lex@nospam.peng.nl>
Subject: changing a html page for printing
Message-Id: <nec40ugf9apbtv8amfp4tndrk1p82a212s@4ax.com>
Hi,
I'm thinking of trying the following:
on a web site, all pages should have 2 tags in them, for example:
<print> </print>
when clicked on the 'print this page' link, the page should be read by
my perlscript, cut all the information that is not between the <print>
and </print> tags and return with different information, for example,
black text on white background, and the source of the page.
How do I say in perl:
look for <print> and </print> and make anything in between $result ?
Thanks!
Lex
------------------------------
Date: Mon, 26 Nov 2001 13:40:23 -0000
From: "brian norman" <brian.norman@gecm.com>
Subject: Re: changing a html page for printing
Message-Id: <3c0242dd$1@pull.gecm.com>
"Lex Thoonen" <lex@nospam.peng.nl> wrote in message
news:nec40ugf9apbtv8amfp4tndrk1p82a212s@4ax.com...
> Hi,
>
> I'm thinking of trying the following:
>
> on a web site, all pages should have 2 tags in them, for example:
>
> <print> </print>
>
> when clicked on the 'print this page' link, the page should be read by
> my perlscript, cut all the information that is not between the <print>
> and </print> tags and return with different information, for example,
> black text on white background, and the source of the page.
>
> How do I say in perl:
>
> look for <print> and </print> and make anything in between $result ?
You could try using 'index' .....
index STR,SUBSTR,POSITION
index STR,SUBSTR
Returns the position of the first occurrence of SUBSTR in STR at or after
POSITION. If POSITION is omitted, starts searching from the beginning of the
string. The return value is based at 0 (or whatever you've set the $[
variable to--but don't do that). If the substring is not found, returns one
less than the base, ordinarily -1.
------------------------------
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.
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 V10 Issue 2206
***************************************