[17422] in Perl-Users-Digest
Perl-Users Digest, Issue: 4842 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Nov 8 03:06:16 2000
Date: Wed, 8 Nov 2000 00: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: <973670711-v9-i4842@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 8 Nov 2000 Volume: 9 Number: 4842
Today's topics:
Can't locate a module in @INC under Debian <the_ferret@my-deja.com>
Getting 500 Undefined subroutine &HTML::Entities::decod <theepan143@home.com>
Re: How can I sent a GIF to the browser <fschlicht@tourisline.de>
Re: how to use variables in perl -e mode (Tad McClellan)
Re: MS SQL & Perl MSherrill@compuserve.com
Re: OOP and information hiding (Damian Conway)
Re: OOP and information hiding (Damian Conway)
Re: Passing a perl array to a C subroutine <vidulats@yahoo.co.uk>
Re: percent-underscore: %_ (Alan Barclay)
Re: percent-underscore: %_ (Martien Verbruggen)
Re: percent-underscore: %_ (Mark-Jason Dominus)
Re: percent-underscore: %_ (Martien Verbruggen)
Re: percent-underscore: %_ (Mark-Jason Dominus)
Re: Perl and mysql <Rainer.Matzke@gmx.de>
Re: Perl and Outlook <sigvald.refsum@siemens.no>
Re: Pushing a hash on to a stack... (Martien Verbruggen)
Re: Pushing a hash on to a stack... (Martien Verbruggen)
Re: Pushing a hash on to a stack... (Tad McClellan)
Re: Pushing a hash on to a stack... (Christopher Burke)
Re: Pushing a hash on to a stack... (Steven Smolinski)
Re: Pushing a hash on to a stack... (Christopher Burke)
Re: Pushing a hash on to a stack... (Christopher Burke)
Re: Pushing a hash on to a stack... (Christopher Burke)
Re: Pushing a hash on to a stack... (Christopher Burke)
Re: Quick short easy question <paul.g@cableinet.co.uk>
Re: Sort (Tad McClellan)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 08 Nov 2000 07:14:02 GMT
From: Bruce <the_ferret@my-deja.com>
Subject: Can't locate a module in @INC under Debian
Message-Id: <8uaufo$vor$1@nnrp1.deja.com>
I'm writing a script to cycle my ISDN router through its command line
interface. I'm using Telnet.pm but Perl can't locate the module. Here's
the error thrown:
Can't locate auto/Net/Telnet/outputlog.al in @INC (@INC contains:
/usr/lib/perl5/5.00503/i586-linux
/usr/lib/perl5/5.00503 /usr/lib/perl5/site_perl/5.005/i586-linux
/usr/lib/perl5/site_perl/5.005
Interestingly enough, I execute an slocate Telnet.pm to find Telnet.pm
and here is the output:
/usr/lib/perl5/Net/Telnet.pm
/usr/lib/perl5/site_perl/5.005/Net/Telnet.pm
/usr/local/lib/site_perl/Net/Telnet.pm
It appears that I've got more than one version of Perl running and it's
putting it's packages in different locations. So I used the CPAN module
to install Net::Telnet and it said that the module was already up to
date.
BTW, I'm running Debian for Intel and the Perl version is
version 5.005_03 built for i586-linux.
On a side note, whenever I run apt-get, I receive the following error:
debconf: Perl may be unconfigured (Can't locate
Debian/DebConf/ConfigDb.pm in @INC (@INC contains: /
usr/lib/perl5/5.00503/i586-linux /usr/lib/perl5/5.00503
/usr/lib/perl5/site_perl/5.005/i586-linux /u
sr/lib/perl5/site_perl/5.005 .) at (eval 1) line 3.
BEGIN failed--compilation aborted at (eval 1) line 3.
) -- aborting
It would appear that these two problems are one in the same.
Can someone help me to resolve this issue?
Thanks,
Bruce
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 08 Nov 2000 05:24:54 GMT
From: "theepan" <theepan143@home.com>
Subject: Getting 500 Undefined subroutine &HTML::Entities::decode_entities called
Message-Id: <Gs5O5.57150$78.17390529@news3.rdc1.on.home.com>
Getting 500 Undefined subroutine &HTML::Entities::decode_entities called
I am using win98 & Appache & ActiveState Perl. I am getting this error!
I Did was
#!Perl
use LWP::Simple;
use LWP::UserAgent;
print "Content-type: text/html\n\n";
$ua = new LWP::UserAgent;
$ua->agent("$0/0.1 " . $ua->agent);
$ua->agent("Mozilla/8.0");
$req = new HTTP::Request 'GET' => 'http://www.altavista.com';
$req->header('Accept' => 'text/html');
# send request
$res = $ua->request($req);
# check the outcome
if ($res->is_success) {
print $res->content;
} else {
print "Error: " . $res->status_line . "\n";
}
If Anyone Could give me a hand! It would be nice....
------------------------------
Date: Wed, 8 Nov 2000 08:16:04 +0100
From: "Frank Schlicht" <fschlicht@tourisline.de>
Subject: Re: How can I sent a GIF to the browser
Message-Id: <973667749.95605@news.mediaWays.net>
Yes, the code is not optimal, but I can say the picture exists in the
directory. I write the content of the GIF into a log-file so I see that the
GIF successfully open.
Regards
Frank
Erik van Roode <newsposter@cthulhu.demon.nl> schrieb in im Newsbeitrag:
8u9895$hqr$3@internal-news.uu.net...
> Frank Schlicht <fschlicht@tourisline.de> wrote:
>
> > open(DATEI, "bild.gif");
>
> You're not checking whether the open succeeded here.
>
> Erik
>
------------------------------
Date: Tue, 7 Nov 2000 23:41:13 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: how to use variables in perl -e mode
Message-Id: <slrn90hmb9.73k.tadmc@magna.metronet.com>
On Tue, 7 Nov 2000 18:14:53 -0600, Jin Zhao <jzhao2@Bayou.UH.EDU> wrote:
>
>I am trying to use variables in perl -e mode, but always get errors of
>"undefined variables".
Where is the error message text?
Perl has no message like the one you describe.
_csh_ has a message kind of like that, but we can't really
tell because you have withheld the text of the message
that you want help with!
(
But you probably already knew that, because there is
an entry for "Undefined variable" in perldiag.pod,
which you have doubtless already checked, right?
)
Messages are meant to help with debugging. You should include
them if you want debugging help. They help the helper help.
--
Tad McClellan SGML consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 08 Nov 2000 07:55:15 GMT
From: MSherrill@compuserve.com
Subject: Re: MS SQL & Perl
Message-Id: <3a08d190.49432269@news.compuserve.com>
On Tue, 07 Nov 2000 14:13:31 -0500, Henry Hartley
<hartleh1@westat.com> wrote:
>my $dbh = DBI->connect("DBI:ODBC:DatabaseName", "$user", "$password") ||
>die "Can't connect to database: $DBI::errstr\n\n" ;
"DatabaseName" seems to confuse newbies. You have to provide the data
*source* name, which you assign in the Control Panel's ODBC applet.
It may or may not be the same as the name of the database.
--
Mike Sherrill
Information Management Systems
------------------------------
Date: 8 Nov 2000 06:05:33 GMT
From: damian@cs.monash.edu.au (Damian Conway)
Subject: Re: OOP and information hiding
Message-Id: <8uaqfd$n1o$1@towncrier.cc.monash.edu.au>
nospam@hairball.cup.hp.com (Richard J. Rauenzahn) writes:
> As I think Abigail alluded to, I could write OO conventions in C similar
> to those in Perl -- does that make C OO?
That's not a meaningful question. It depends entirely by what one means
by "object-oriented":
* If you mean "permits OO styles of programming" then the
answer is "yes".
* If you mean "supports OO styles of programming" then the
answer is "maybe".
* If you mean "mandates OO styles of programming" then the
answer is "no".
> I think part of the argument lies in where you draw the line at "Perl
> -- The Language." I don't consider the modules that provide OO
> conventions to be part of "The Language."
Then C++ has no I/O, nor any RTTI mechanism, nor standard exceptions.
There is no "line"; there is only the question of whether a language
supports a give feature set that may be considered useful in OO
programming. All languages do to some extent (one could programm in an OO
style in assembler, though it wouldn't be much fun!), but the point is
that it's a continuum.
OO is a mindset and a way of structuring code. There are no "OO
languages", only languages that allow (and sometimes help) one to do OO
programming. Perl is indisputably one of those.
Damian
------------------------------
Date: 8 Nov 2000 06:07:35 GMT
From: damian@cs.monash.edu.au (Damian Conway)
Subject: Re: OOP and information hiding
Message-Id: <8uaqj7$n73$1@towncrier.cc.monash.edu.au>
tjla@guvfybir.qlaqaf.bet (Gwyn Judd) writes:
>Sure, but you shouldn't have to document the *private* variables that
>you use as well. That's what makes them, well, private.
And, in Perl, if you do actually make them private (via closures, or
flyweight scalars, or Tie::Securehash) then you *don't* have to
document them.
:-)
Damian
------------------------------
Date: Wed, 08 Nov 2000 05:30:06 -0000
From: <vidulats@yahoo.co.uk>
Subject: Re: Passing a perl array to a C subroutine
Message-Id: <t0hp6uap28p9c8@corp.supernews.com>
Perl passes to a data structure.
To access the actual string you will need (one of) the SvPV macro(s).
perldoc perlguts explains that in detail. Other pertinent man pages are
perlxs, perlxstut,
and perlapi.
Vidula
bfasula wrote:
>
>
> Does anyone know how to pass a perl array to a C subroutine. How do you
> define the passed array in the C subroutine, as a char * or int *?
> Do you use @X for the calling perl statement?
>
> Thanks
> --
> Bill Fasula
>
> http://www.netcom.com/~bfasula
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
--
Posted via CNET Help.com
http://www.help.com/
------------------------------
Date: 8 Nov 2000 05:06:44 GMT
From: gorilla@elaine.furryape.com (Alan Barclay)
Subject: Re: percent-underscore: %_
Message-Id: <973660002.812211@elaine.furryape.com>
Keywords: Dobbs, Judaism, conservation, savoy
In article <3a08da7b.7de$73@news.op.net>,
Mark-Jason Dominus <mjd@plover.com> wrote:
>In article <YX2O5.19443$Wq1.9317405@nnrp5-w.sbc.net>,
>Brian McDonald <mcdonabNO@SPAMyahoo.com> wrote:
>>i don't really understand the responses that people are posting to my
>>question though. why is %_ not in perlvar???
>
>Because it's not a Perl special variable. There is nothing to
>document. What do you think it should say in perlvar? "%_: There is
>nothing special about this variable, but maybe some module uses it."
There are also a lot of other not-special hashs, just like %_, for
example "%!". Basically, if there is a $x and a @x (where x is some symbol),
then there will be an equvilant %x. It will be always accessable, and
you can use it without defining it even if use strict is on.
#!/usr/local/bin/perl -w
use strict;
%!=(this=>1,that=>2);
package test;
print keys (%!),"\n";
------------------------------
Date: Wed, 08 Nov 2000 05:10:38 GMT
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: percent-underscore: %_
Message-Id: <slrn90ho2g.7ck.mgjv@verbruggen.comdyn.com.au>
On Tue, 7 Nov 2000 18:32:28 -0800,
Brian McDonald <mcdonabNO@SPAMyahoo.com> wrote:
>
> i don't really understand the responses that people are posting to my
> question though. why is %_ not in perlvar???
The main answer:
Because it has no special meaning to Perl. The perlvar documentation
only documents variables that are in some way special.
Perl, the language, doesn't do anything special with %_. $_ is
special because it gets used implicitly by many operators. $. is
special because it gets incremented when you're reading a file. All
the other special variables documented in perlvar under some
circumstances all are 'automagically' read or set by Perl, or one of
its operators. %_ does not fall in this category.
Anyway, the bottom of the perlvar documentation states that (in the
section on the syntax of variable names):
Perl identifiers that begin with digits, control charac
ters, or punctuation characters are exempt from the
effects of the `package' declaration and are always forced
to be in package `main'. A few other names are also
exempt:
ENV STDIN
INC STDOUT
ARGV STDERR
ARGVOUT
SIG
This explains what I already sort of rambled on about above: Even
though %_ isn't a special variable in the sense that $_ is one, the
fact that its name starts with a punctuation character means that it's
always in main::, and always available.
Martien
--
Martien Verbruggen |
Interactive Media Division | The gene pool could use a little
Commercial Dynamics Pty. Ltd. | chlorine.
NSW, Australia |
------------------------------
Date: Wed, 08 Nov 2000 05:20:21 GMT
From: mjd@plover.com (Mark-Jason Dominus)
Subject: Re: percent-underscore: %_
Message-Id: <3a08e295.94d$39a@news.op.net>
Keywords: Dobbs, Judaism, conservation, savoy
In article <973660002.812211@elaine.furryape.com>,
Alan Barclay <gorilla@elaine.furryape.com> wrote:
>In article <3a08da7b.7de$73@news.op.net>,
>Mark-Jason Dominus <mjd@plover.com> wrote:
>>In article <YX2O5.19443$Wq1.9317405@nnrp5-w.sbc.net>,
>>Brian McDonald <mcdonabNO@SPAMyahoo.com> wrote:
>>>i don't really understand the responses that people are posting to my
>>>question though. why is %_ not in perlvar???
>>
>>Because it's not a Perl special variable. There is nothing to
>>document. What do you think it should say in perlvar? "%_: There is
>>nothing special about this variable, but maybe some module uses it."
>
>There are also a lot of other not-special hashs, just like %_, for
>example "%!".
You picked the wrong one. %! is special as of 5.005 or so.
--
@P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f|ord
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print
------------------------------
Date: Wed, 08 Nov 2000 05:29:06 GMT
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: percent-underscore: %_
Message-Id: <slrn90hp55.7ck.mgjv@verbruggen.comdyn.com.au>
On Wed, 08 Nov 2000 05:20:21 GMT,
Mark-Jason Dominus <mjd@plover.com> wrote:
> In article <973660002.812211@elaine.furryape.com>,
> Alan Barclay <gorilla@elaine.furryape.com> wrote:
>>
>>There are also a lot of other not-special hashs, just like %_, for
>>example "%!".
>
> You picked the wrong one. %! is special as of 5.005 or so.
But not documented :)
It's the first time I heard of it, so I started looking. perl5005delta
says it's tied to the Errno module. perldiag contains an error
message, that states more or less the same. perllocale has a vague
reference.
Martien
--
Martien Verbruggen |
Interactive Media Division | Useful Statistic: 75% of the people
Commercial Dynamics Pty. Ltd. | make up 3/4 of the population.
NSW, Australia |
------------------------------
Date: Wed, 08 Nov 2000 06:07:57 GMT
From: mjd@plover.com (Mark-Jason Dominus)
Subject: Re: percent-underscore: %_
Message-Id: <3a08edbc.ae1$286@news.op.net>
In article <slrn90hp55.7ck.mgjv@verbruggen.comdyn.com.au>,
Martien Verbruggen <mgjv@tradingpost.com.au> wrote:
>On Wed, 08 Nov 2000 05:20:21 GMT,
> Mark-Jason Dominus <mjd@plover.com> wrote:
>> In article <973660002.812211@elaine.furryape.com>,
>> Alan Barclay <gorilla@elaine.furryape.com> wrote:
>>>
>>>There are also a lot of other not-special hashs, just like %_, for
>>>example "%!".
>>
>> You picked the wrong one. %! is special as of 5.005 or so.
>
>But not documented :)
It's documented in Errno. But I agree that someone should add it to perlvar.
--
@P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f|ord
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print
------------------------------
Date: Tue, 7 Nov 2000 16:50:34 +0100
From: "Rainer Matzke" <Rainer.Matzke@gmx.de>
Subject: Re: Perl and mysql
Message-Id: <3a0908c3$0$29231$4dbef881@businessnews.de.uu.net>
have a look at perldoc DBD::mysql
------------------------------
Date: Wed, 08 Nov 2000 08:50:27 +0100
From: Sigvald Refsum <sigvald.refsum@siemens.no>
Subject: Re: Perl and Outlook
Message-Id: <3A0905C3.E32F956C@siemens.no>
0. Late response due to work load
1. Yes
2. The points about the MS security model (...) may cause you to reconsider
using
outlook at all for script based mail.
Best regards
Sigvald
>
------------------------------
Date: Wed, 08 Nov 2000 05:23:58 GMT
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Pushing a hash on to a stack...
Message-Id: <slrn90horh.7ck.mgjv@verbruggen.comdyn.com.au>
On Wed, 08 Nov 2000 02:51:54 GMT,
Gwyn Judd <tjla@guvfybir.qlaqaf.bet> wrote:
> I was shocked! How could Christopher Burke <craznar@hotmail.com>
> say such a terrible thing:
>>Can any perl experts emulate the following using the push/pop idea.
>>
>>%{$fulldata[scalar @fulldata]} = %hash;
>
> like this:
>
> push @fulldata, \%hash;
Careful, that would push a reference to the same hash onto @fulldata,
if you follow the example code that was submitted. Either make a copy,
or use lexical scoping
push @fulldata, {%hash};
%hash = ();
# ready for the next one
>>And no - I don't want to use references.
>
> Why? (and if you really don't want to use references then you are
> screwed)
Not entirely, see my other post. However, it is slightly silly
not to want to use references. But who are we to doubt the good
reasons that the OP might have? I'm sure the OP has thought long and
hard about this, and has made the decision not to use references for
sound reasons.
Martien
--
Martien Verbruggen |
Interactive Media Division | Little girls, like butterflies, need
Commercial Dynamics Pty. Ltd. | no excuse - Lazarus Long
NSW, Australia |
------------------------------
Date: Wed, 08 Nov 2000 05:31:14 GMT
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Pushing a hash on to a stack...
Message-Id: <slrn90hp95.7ck.mgjv@verbruggen.comdyn.com.au>
On Wed, 08 Nov 2000 04:35:02 GMT,
Mark-Jason Dominus <mjd@plover.com> wrote:
> In article <8FE677620craznar@130.102.2.1>,
> Christopher Burke <craznar@hotmail.com> wrote:
>>And no - I don't want to use references.
>
>
> Hi. Can anyone help me? I am looking for a large gray animal with
> floppy ears and a long trunk.
>
> No elephants, please.
does Charles, prince of Wales, qualify?
Martien
--
Martien Verbruggen |
Interactive Media Division | You can't have everything, where
Commercial Dynamics Pty. Ltd. | would you put it?
NSW, Australia |
------------------------------
Date: Tue, 7 Nov 2000 23:52:19 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Pushing a hash on to a stack...
Message-Id: <slrn90hn03.73k.tadmc@magna.metronet.com>
On 8 Nov 2000 01:57:05 GMT, Christopher Burke <craznar@hotmail.com> wrote:
>Can any perl experts emulate the following using the push/pop idea.
>And no - I don't want to use references.
*Why* not?
You seem to have correctly predicted that the experts would
tell you to use references, yet you provide no reasons for
your prohibiting them.
If you say what the problem with references is, perhaps an
expert can show how that problem can be overcome.
I don't think experts can help if you discard potential
solutions without saying why they should be rejected.
So, why are you resisting references?
--
Tad McClellan SGML consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: 8 Nov 2000 06:47:25 GMT
From: craznar@hotmail.com (Christopher Burke)
Subject: Re: Pushing a hash on to a stack...
Message-Id: <8FE6A25D6craznar@130.102.2.1>
The example code is a trivial example, in actual fact I need to push the
hash onto a stack in a loop which processes complex incoming data.
There is a valid requirement to use push - the real code is way to complex
to try and post here.
mgjv@tradingpost.com.au (Martien Verbruggen) wrote in
<slrn90he7p.7ck.mgjv@verbruggen.comdyn.com.au>:
>On 8 Nov 2000 01:57:05 GMT,
> Christopher Burke <craznar@hotmail.com> wrote:
>> Can any perl experts emulate the following using the push/pop idea.
>>
>> %{$fulldata[scalar @fulldata]} = %hash;
>>
>>
>> Basically I want to be able to do this sort of thing...
>
>What you want to do is read the perlref, perldsc and perllol
>documentation.
>
>> $hash{X} = 4;
>> $hash{Y} = 5;
>> # push %hash onto stack .....
>> $hash{X} = 4;
>> $hash{Y} = 5;
>> # push %hash onto stack .....
>
>You will need to create a new hash each time, or a new hash reference.
>What you want to do, is create an array of hash references, where each
>reference is one of those things you're pushing. But using push for
>that only makes sens if you're doing this in a loop or something. If
>it's linear code like that, you just do
>
>#!/usr/local/bin/perl -l
>use warnings;
>use strict;
>
>my @stack;
>
>my $i = 0;
>$stack[$i]{X} = 4;
>$stack[$i]{Y} = 5;
>$i++;
>$stack[$i]{X} = 6;
>$stack[$i]{Y} = 7;
>$i++;
># etc..
>
>print $stack[0]{X};
>print $stack[0]{Y};
>print $stack[1]{X};
>print $stack[1]{Y};
>
>Note that this last bit is not valid use for a formal stack. You push
>things on, and you pop things off. You don't access elements directly.
>But I'll keep using the term stack anyway, because Perl arrays can at
>least be treated as one.
>
>For a loop, it probably makes more sense to use a lexially scoped
>hash, and then you actually push it on the stack.
>
>#!/usr/local/bin/perl -l
>use warnings;
>use strict;
>
>my @stack;
>
>for (1 .. 18)
>{
> my %hash;
> $hash{X} = $_ * 10 * @stack;
> $hash{Y} = $_ * 10 * @stack;
> push @stack, \%hash;
>}
>
>print "Got " . @stack . " elements";
>
>foreach my $hash_ref (@stack)
>{
> print $hash_ref->{X};
> print $hash_ref->{Y};
>}
>
># OR
>
>foreach my $index (0 .. $#stack)
>{
> print $stack[$index]{X};
> print $stack[$index]{Y};
>}
>
>> And no - I don't want to use references.
>
>What a silly attitude. Why don't you use the things that are
>specifically well suited for the job? How do you open files? Without
>open()? Do you get into buildings through the windows?
>
>Oh well. Suit yourself.
>
>You won't have any order, except what you impose yourself. You'll also
>have to keep track of the number of things you put on the 'stack' [1]:
>
>#!/usr/local/bin/perl -l
>use warnings;
>use strict;
>
>my %stack;
>my $stack_size;
>
>for (1 .. 18)
>{
> $stack{$_,'X'} = $_ * 10;
> $stack{$_,'Y'} = $_ * 20;
> $stack_size++;
>}
>
>foreach (1 .. $stack_size)
>{
> print $stack{$_,'X'};
> print $stack{$_,'Y'};
>}
>
>Martien
>
>[1] Of course, this has no longer any resemblance to a stack at all.
------------------------------
Date: Wed, 08 Nov 2000 06:48:27 GMT
From: sjs@yorku.ca (Steven Smolinski)
Subject: Re: Pushing a hash on to a stack...
Message-Id: <slrn90i1lr.3df.sjs@ragnar.stevens.gulch>
Martien Verbruggen <mgjv@tradingpost.com.au> wrote:
> On Wed, 08 Nov 2000 04:35:02 GMT,
> Mark-Jason Dominus <mjd@plover.com> wrote:
> > In article <8FE677620craznar@130.102.2.1>,
> > Christopher Burke <craznar@hotmail.com> wrote:
> >>And no - I don't want to use references.
> >
> >
> > Hi. Can anyone help me? I am looking for a large gray animal with
> > floppy ears and a long trunk.
> >
> > No elephants, please.
>
> does Charles, prince of Wales, qualify?
I haven't seen his trunk; have you? :-)
Sorry, I couldn't resist that straight line.
Steve
--
But they all have the same weakness: they're flipping web crud.
--Tom Christiansen in <3a02e17a@cs.colorado.edu>
------------------------------
Date: 8 Nov 2000 06:48:45 GMT
From: craznar@hotmail.com (Christopher Burke)
Subject: Re: Pushing a hash on to a stack...
Message-Id: <8FE6A17EFcraznar@130.102.2.1>
tjla@guvfybir.qlaqaf.bet (Gwyn Judd) wrote in
<slrn90hfu9.hbr.tjla@thislove.dyndns.org>:
>I was shocked! How could Christopher Burke <craznar@hotmail.com>
>say such a terrible thing:
>>Can any perl experts emulate the following using the push/pop idea.
>>
>>%{$fulldata[scalar @fulldata]} = %hash;
>
>like this:
>
>push @fulldata, \%hash;
>
>>And no - I don't want to use references.
>
>Why? (and if you really don't want to use references then you are
>screwed)
>
I have a reason related to the 'meta language' I am using to program the
incoming data. Given "%{$fulldata[scalar @fulldata]} = %hash;" does it and
I don't need references - then I would have thought that push could be
used.
------------------------------
Date: 8 Nov 2000 06:51:02 GMT
From: craznar@hotmail.com (Christopher Burke)
Subject: Re: Pushing a hash on to a stack...
Message-Id: <8FE6A4D54craznar@130.102.2.1>
mjd@plover.com (Mark-Jason Dominus) wrote in <3a08d7ec.758$101
@news.op.net>:
>In article <8FE677620craznar@130.102.2.1>,
>Christopher Burke <craznar@hotmail.com> wrote:
>>And no - I don't want to use references.
>
>
>Hi. Can anyone help me? I am looking for a large gray animal with
>floppy ears and a long trunk.
>
>No elephants, please.
So you believe I should use references, well I know I shouldn't and have
valid reasons not to.
I am gathering by the tone of these responses that people are incapable of
answering a question - or that Perl is incapable of pushing hashes onto a
stack.
Either way I will write my on push/pop to get around the problem.
------------------------------
Date: 8 Nov 2000 06:54:24 GMT
From: craznar@hotmail.com (Christopher Burke)
Subject: Re: Pushing a hash on to a stack...
Message-Id: <8FE6AC28Bcraznar@130.102.2.1>
tadmc@metronet.com (Tad McClellan) wrote in
<slrn90hn03.73k.tadmc@magna.metronet.com>:
>On 8 Nov 2000 01:57:05 GMT, Christopher Burke <craznar@hotmail.com> wrote:
>
>>Can any perl experts emulate the following using the push/pop idea.
>
>>And no - I don't want to use references.
>
>
>*Why* not?
>
>You seem to have correctly predicted that the experts would
>tell you to use references, yet you provide no reasons for
>your prohibiting them.
The reason is too complex to go into, but it revolves around the fact that
I am writing a perl routine that will use a meta-language to define its
operation....
>If you say what the problem with references is, perhaps an
>expert can show how that problem can be overcome.
Why bother, given it cannot be done I'll just write my own push/pop to
solve the problem.
>I don't think experts can help if you discard potential
>solutions without saying why they should be rejected.
Using references adds complexity to heaps of places, using my 'push'
similator adds complexity to one place - and that place is hidden from end
users.
>So, why are you resisting references?
To solve a problem that requires no references to be used.
------------------------------
Date: 8 Nov 2000 06:55:16 GMT
From: craznar@hotmail.com (Christopher Burke)
Subject: Re: Pushing a hash on to a stack...
Message-Id: <8FE6AB892craznar@130.102.2.1>
mjd@plover.com (Mark-Jason Dominus) wrote in <3a08d7ec.758$101
@news.op.net>:
>In article <8FE677620craznar@130.102.2.1>,
>Christopher Burke <craznar@hotmail.com> wrote:
>>And no - I don't want to use references.
>
>
>Hi. Can anyone help me? I am looking for a large gray animal with
>floppy ears and a long trunk.
>
>No elephants, please.
Hi, Can anyone help me? I am looking for a large gray animal with floppy
ears and a long trunk.
Sure - I found this rabbit, will it help.
------------------------------
Date: Wed, 08 Nov 2000 05:50:24 GMT
From: "Paulgee" <paul.g@cableinet.co.uk>
Subject: Re: Quick short easy question
Message-Id: <AQ5O5.12076$aT1.1181803@news3.cableinet.net>
Just dropped in to say thanks for that' I Appreciated it anyway, the amount
of find and replace saved here on escape is a perlsend:-)
I know about (print <<EOF; etc.) But alas have not Experimented with this
yet.
Paul
Henry Hartley <hartleh1@westat.com> wrote in message
news:3A081EAE.4B4D5A90@westat.com...
> donoddy@my-deja.com wrote:
> >
> > Hi!
> >
> > I would like to modify this line of my script:
> >
> > print "<A HREF=\"$advert_url\">";
> >
> > so it opens the link in a new window. Is this
> > the correct way to do it:
> >
> > print "<A HREF=\"$advert_url\" target=\"_top\">";
> >
> > I'm completly new to perl thats why this question is a bit
> > silly.
>
> So new to Perl, in fact, that you didn't notice that this question is
> about HTML.
>
> But, on a Perl subject, I'd have written that line like this to avoid
> having to escape the " within the line:
>
> print qq|<A HREF="$advert_url" target="new_window_name">| ;
>
> --
> Henry Hartley
> Westat
> Rockville, Maryland, USA
------------------------------
Date: Wed, 8 Nov 2000 00:14:20 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Sort
Message-Id: <slrn90ho9c.73k.tadmc@magna.metronet.com>
On Tue, 7 Nov 2000 23:01:12 -0500, Mike Scozzari
<mscozzari@ameritech.net> wrote:
>I need to sort alphanumeric data such as A1, A3, B10, B4, C11, C12, C3 etc.
>into a table format such as:
[ snip data ]
>The data has to be sorted first in alphabetical order then in numerical
>sequence as above.
----------------------------
#!/usr/bin/perl -w
use strict;
my @list = qw/C11 A3 B4 C3 A1 B10 C12/;
# a bad sloooow way
my @sorted = sort { substr($a, 0, 1) cmp substr($b, 0, 1) or
substr($a, 1) <=> substr($b, 1)
} @list;
print "$_\n" foreach @sorted;
print "-------------\n";
# a better way - Schwartzian Transform
@sorted = map { $_->[0] }
sort { $a->[1] cmp $b->[1] or
$a->[2] <=> $b->[2]
}
map { [ $_, substr($_, 0, 1), substr($_, 1) ] } @list;
# ^ ^ ^
# 0 1 2 # three elems in anon array
print "$_\n" foreach @sorted;
----------------------------
Or, use a pattern match in list context to split up the strings:
map { [ $_, /(.)(.*)/s ] } @list;
--
Tad McClellan SGML consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
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 V9 Issue 4842
**************************************