[22106] in Perl-Users-Digest
Perl-Users Digest, Issue: 4328 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Dec 31 21:27:12 2002
Date: Tue, 31 Dec 2002 18:25:29 -0800 (PST)
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, 31 Dec 2002 Volume: 10 Number: 4328
Today's topics:
Re: Sleep Until Key Press <mgjv@tradingpost.com.au>
Re: Sleep Until Key Press (Anno Siegel)
Re: Sleep Until Key Press <mgjv@tradingpost.com.au>
Re: Sleep Until Key Press <joe@benburb.demon.co.uk>
Re: Sleep Until Key Press <mgjv@tradingpost.com.au>
Re: The Superiority of PHP over Perl <murat.uenalan@gmx.de>
Re: The Superiority of PHP over Perl <kasp@NO_SPAMepatra.com>
Using Expect to telnet to port 80 (not Expect::Simple) (ATB)
Re: Using Expect to telnet to port 80 (not Expect::Simp <mgjv@tradingpost.com.au>
Re: Using Expect to telnet to port 80 (not Expect::Simp (Malcolm Dew-Jones)
Using Expect::Simple to telnet to port 80 & retrieve ra (ATB)
Re: Using Expect::Simple to telnet to port 80 & retriev <ethan@draupnir.gso.saic.com>
Re: Using Expect::Simple to telnet to port 80 & retriev <tony_curtis32@yahoo.com>
Using perl to captuer IP of person submitting a form (Bill)
Re: Using perl to captuer IP of person submitting a for <gordan@_NOSPAM_bobich.net>
Re: Using perl to captuer IP of person submitting a for <jurgenex@hotmail.com>
whats the syntax to get a scalar out an array of refere <isresi1@xs4all.nl>
Re: whats the syntax to get a scalar out an array of re <dmcbride@naboo.to.org.no.spam.for.me>
Re: whats the syntax to get a scalar out an array of re <ethan@draupnir.gso.saic.com>
Re: whats the syntax to get a scalar out an array of re (Tad McClellan)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 31 Dec 2002 09:17:26 +1100
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: Sleep Until Key Press
Message-Id: <slrnb11hfm.4tt.mgjv@martien.heliotrope.home>
On 30 Dec 2002 12:13:53 GMT,
Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
> Blnukem <blnukem@hotmail.com> wrote in comp.lang.perl.misc:
>> Hi all
>>
>> Is there a way to sleep(300) or until a key is pressed say the spacebar?
>
> You can use alarm() to time out a read request like this:
>
> $SIG{ ALRM} = sub { die };
> alarm( 300);
> my $ans;
> eval { $ans = <STDIN> };
> if ( defined $ans ) {
> print "user replied\n";
> } else {
> print "timeout\n";
> }
>
> See also the faq on this: "perldoc -q 'slow event'".
>
> Another approach could use select() to do the timeout.
Note that the above requires return to be pressed, since <> reads a
line.
If you do want to capture a single keypress, the Term::ReadKey module
is probably your best bet. You don't mention your platform, but it's
available for unices, and for Windows, with a few limitations.
Martien
--
|
Martien Verbruggen | My friend has a baby. I'm writing down all
| the noises the baby makes so later I can ask
| him what he meant - Steven Wright
------------------------------
Date: 30 Dec 2002 22:33:50 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Sleep Until Key Press
Message-Id: <auqhke$659$3@mamenchi.zrz.TU-Berlin.DE>
Martien Verbruggen <mgjv@tradingpost.com.au> wrote in comp.lang.perl.misc:
> On 30 Dec 2002 12:13:53 GMT,
> Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
> > Blnukem <blnukem@hotmail.com> wrote in comp.lang.perl.misc:
> >> Hi all
> >>
> >> Is there a way to sleep(300) or until a key is pressed say the spacebar?
> >
> > You can use alarm() to time out a read request like this:
> >
> > $SIG{ ALRM} = sub { die };
> > alarm( 300);
> > my $ans;
> > eval { $ans = <STDIN> };
> > if ( defined $ans ) {
> > print "user replied\n";
> > } else {
> > print "timeout\n";
> > }
> >
> > See also the faq on this: "perldoc -q 'slow event'".
> >
> > Another approach could use select() to do the timeout.
>
> Note that the above requires return to be pressed, since <> reads a
> line.
[good advice concerning Term::ReadKey]
Thanks, I forgot to mention that. I also forgot to reset the alarm
timer in the code above: immediately after "eval ..." please add
"alarm( 0);". Otherwise an alarm will kill the program without
eval protection after the user replied.
Anno
PS: Oh, and since we're talking, I just read and enjoyed your _Graphics
Programming in Perl_. You have a pretty daughter :)
------------------------------
Date: Tue, 31 Dec 2002 09:56:45 +1100
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: Sleep Until Key Press
Message-Id: <slrnb11jpd.4tt.mgjv@martien.heliotrope.home>
On 30 Dec 2002 22:33:50 GMT,
Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
>
> PS: Oh, and since we're talking, I just read and enjoyed your _Graphics
> Programming in Perl_. You have a pretty daughter :)
Thanks :) Glad you enjoyed it.
I'll tell my daughter what you said once she's old enough not to let it
get to her head. :)
Martien
--
|
Martien Verbruggen | Begin at the beginning and go on till you
| come to the end; then stop.
|
------------------------------
Date: 31 Dec 2002 09:23:10 +0000
From: Joe Mc Cool <joe@benburb.demon.co.uk>
Subject: Re: Sleep Until Key Press
Message-Id: <86hecu5ypt.fsf@benburb.demon.co.uk>
Martien Verbruggen <mgjv@tradingpost.com.au> writes:
> On 30 Dec 2002 22:33:50 GMT,
> Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
> >
> > PS: Oh, and since we're talking, I just read and enjoyed your _Graphics
> > Programming in Perl_. You have a pretty daughter :)
>
> Thanks :) Glad you enjoyed it.
I enjoyed it too Martien and gave it a +ve review.
Well done.
--
Joe Mc Cool
========================================================================
Tangent Computer Research BT71 7LN (www.tangent-research.com)
voice:(44)2837-548074fax:(44)-870-0520185 The more you say the less the better.
------------------------------
Date: Wed, 1 Jan 2003 01:12:19 +1100
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: Sleep Until Key Press
Message-Id: <slrnb139e3.4tt.mgjv@martien.heliotrope.home>
On 31 Dec 2002 09:23:10 +0000,
Joe Mc Cool <joe@benburb.demon.co.uk> wrote:
> Martien Verbruggen <mgjv@tradingpost.com.au> writes:
>
>> On 30 Dec 2002 22:33:50 GMT,
>> Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
>> >
>> > PS: Oh, and since we're talking, I just read and enjoyed your _Graphics
>> > Programming in Perl_. You have a pretty daughter :)
>>
>> Thanks :) Glad you enjoyed it.
>
> I enjoyed it too Martien and gave it a +ve review.
I read it, and thank you :)
> Well done.
Thanks :)
Martien
--
|
Martien Verbruggen | prepBut nI vrbLike adjHungarian! qWhat's
| artThe adjBig nProblem? -- Alec Flett
|
------------------------------
Date: Mon, 30 Dec 2002 15:36:26 +0100
From: "Murat Ünalan" <murat.uenalan@gmx.de>
Subject: Re: The Superiority of PHP over Perl
Message-Id: <auplm9$37f$05$1@news.t-online.com>
> method == function == procedure == subroutine == lots-of-others
>
> It's the same thing, no matter what you use it for. The name is just
> a matter of convention.
Yes, and convention is driven to nonsense by people like you ("proof by
exclamation").
Defacto convention: a function is named "method" when its
semantically/syntacticly
bound to an object.
$a->method();
func();
Basta!,
Murat
------------------------------
Date: Tue, 31 Dec 2002 00:40:44 +0530
From: "Kasp" <kasp@NO_SPAMepatra.com>
Subject: Re: The Superiority of PHP over Perl
Message-Id: <auq5nn$bee$1@newsreader.mailgate.org>
Hi All,
If you don't know about Mr. Egg Troll, may I suggest you to do a google
search on the groups for him.
Let me help you ...click on this link below
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&q=%22eggtroll@ya
hoo.com%22
You will notice he is a very smart "thread" starter...and never contributes
to what he starts.
I guess he gets a big kick out of it :-)
Word of Advice:
If the thread is started by Egg Troll...ignore it, skip it or
delete it!
--
Perl is designed to give you several ways to do anything, so
consider picking the most readable one.
-- Larry Wall in the perl man page
------------------------------
Date: 30 Dec 2002 11:12:46 -0800
From: funky_breaks_2000@msn.com (ATB)
Subject: Using Expect to telnet to port 80 (not Expect::Simple)
Message-Id: <42d6b392.0212301112.482c04d8@posting.google.com>
Apologies for those who have read my Expect::Simple query, but after
slogging through the documentation for both, I think Expect will be a
better fit than Expect::Simple.
I'm now using the following, and this actually connects to the server,
but it appears that my GET command is cut off half way.
In fact, it doesn't appear to performing the match before sending the
command.
Why does perl require the send command to precede the expect command?
#!/usr/local/bin/perl -w
use Expect;
$command = "telnet xxx.xxx.xxx.xxx 80";
$timeout = 0;
$match = "Escape character is '^]'.";
my $exp = Expect->spawn( $command ) or die "cannot spawn $command:
$!\n";
$exp->send("GET /dir/index.html HTTP/1.0 \n\n");
$exp->expect($timeout, $match);
$exp->soft_close();
output:
user@hostname> ./program
GET /dir/index.html HTTP/1.0
Trying xxx.xxx.xxx.xxx...
Connected to xxx.xxx.xxx.xxx.
Escape character is '^]'.
HTTP/1.0 400 Bad Request
Thanks!
-v
------------------------------
Date: Tue, 31 Dec 2002 10:18:10 +1100
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: Using Expect to telnet to port 80 (not Expect::Simple)
Message-Id: <slrnb11l1i.4tt.mgjv@martien.heliotrope.home>
On 30 Dec 2002 11:12:46 -0800,
ATB <funky_breaks_2000@msn.com> wrote:
> Apologies for those who have read my Expect::Simple query, but after
> slogging through the documentation for both, I think Expect will be a
> better fit than Expect::Simple.
I think that the LWP modules would be an even better fit. Failing that,
IO::Socket would be my next choice. Net::Telnet I find a little hard to
get to work correctly.
I only ever use Expect when I _have_ to use some external tool that
requires tty-level interaction.
Martien
--
|
Martien Verbruggen | I took an IQ test and the results were
| negative.
|
------------------------------
Date: 30 Dec 2002 15:38:21 -0800
From: yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones)
Subject: Re: Using Expect to telnet to port 80 (not Expect::Simple)
Message-Id: <3e10d8ed@news.victoria.tc.ca>
ATB (funky_breaks_2000@msn.com) wrote:
: Apologies for those who have read my Expect::Simple query, but after
: slogging through the documentation for both, I think Expect will be a
: better fit than Expect::Simple.
: I'm now using the following, and this actually connects to the server,
: but it appears that my GET command is cut off half way.
: In fact, it doesn't appear to performing the match before sending the
: command.
: Why does perl require the send command to precede the expect command?
I'm no expert in expect, but I would think you have this backwards.
Surely you must wait for the result of the telnet connection _before_ you
send the GET command.
$exp->expect($timeout, $match);
# if timed out then die with message
$exp->send("GET /dir/index.html HTTP/1.0 \n\n");
: #!/usr/local/bin/perl -w
: use Expect;
: $command = "telnet xxx.xxx.xxx.xxx 80";
: $timeout = 0;
: $match = "Escape character is '^]'.";
: my $exp = Expect->spawn( $command ) or die "cannot spawn $command:
: $!\n";
: $exp->send("GET /dir/index.html HTTP/1.0 \n\n");
: $exp->expect($timeout, $match);
: $exp->soft_close();
: output:
: user@hostname> ./program
: GET /dir/index.html HTTP/1.0
: Trying xxx.xxx.xxx.xxx...
: Connected to xxx.xxx.xxx.xxx.
: Escape character is '^]'.
: HTTP/1.0 400 Bad Request
: Thanks!
: -v
--
------------------------------
Date: 30 Dec 2002 10:49:39 -0800
From: funky_breaks_2000@msn.com (ATB)
Subject: Using Expect::Simple to telnet to port 80 & retrieve raw web page
Message-Id: <42d6b392.0212301049.27bc2eaf@posting.google.com>
I'm trying to telnet to port 80 on an server and retrieve a webpage
using Expect::Simple in perl. I am mightily confused and the
documentation for Expect::Simple isn't that verbose (from CPAN/perldoc
anyway). I've done searches through here, but can't find any
questions/answers that deal with Expect::Simple.
Two things that would really help is is knowing the following:
Is 'Cmd' the command to be used to initiate the connection? Does perl
know to drop to the unix shell to do that?
Where do I put the commands to be entered after I get what I expect?
I'm assuming it's $obj->send, but i wouldn't be surprised if i was
wrong.
Here's what I've got thus far, a basic copy of the perldoc example:
#!/usr/local/bin/perl -w
use Expect::Simple;
my $obj = new Expect::Simple
{ Cmd => "telnet xxx.xxx.xxx.xxx 80", # substitute numbers for x
:)
Prompt => "Escape character is '^]'.",
Verbose => 0,
Debug => 0,
Timeout => 100,
DisconnectCmd => "\cI]"
};
$obj->send( "GET OAIApp/oaibuild.html HTTP/1.0 \n\n" );
print $obj->before;
print $obj->after;
print $obj->match_str, "\n";
print $obj->match_idx, "\n";
print $obj->error_expect;
print $obj->error;
$expect_object = $obj_expect_handle;
Any help would be greatly appreciated.
-v
------------------------------
Date: 30 Dec 2002 12:28:05 -0800
From: Ethan Brown <ethan@draupnir.gso.saic.com>
Subject: Re: Using Expect::Simple to telnet to port 80 & retrieve raw web page
Message-Id: <vrznqnmeui.fsf@draupnir.gso.saic.com>
>>>>> "ATB" == ATB <funky_breaks_2000@msn.com> writes:
ATB> I'm trying to telnet to port 80 on an server and retrieve a webpage
ATB> using Expect::Simple in perl. I am mightily confused and the
ATB> documentation for Expect::Simple isn't that verbose (from CPAN/perldoc
ATB> anyway). I've done searches through here, but can't find any
ATB> questions/answers that deal with Expect::Simple.
Other options besides Expect::Simple would be to use wget or linx with
backticks, or to use LWP::Simple. See
http://search.cpan.org/author/GAAS/libwww-perl-5.66/lib/LWP/Simple.pm
(from the page)
use LWP::Simple;
$content = get("http://www.sn.no/");
--Ethan Brown
--In a band? Use http://www.WheresTheGig.com for free.
------------------------------
Date: Mon, 30 Dec 2002 13:37:37 -0600
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: Using Expect::Simple to telnet to port 80 & retrieve raw web page
Message-Id: <87vg1bfgce.fsf@limey.hpcc.uh.edu>
>> On 30 Dec 2002 10:49:39 -0800,
>> funky_breaks_2000@msn.com (ATB) said:
> I'm trying to telnet to port 80 on an server and
> retrieve a webpage using Expect::Simple in perl. I am
> mightily confused and the documentation for
Is there any particular reason why you are using expect?
LWP is the easiest way to do it, e.g.
perldoc LWP::Simple
Or for more detailed examples
perldoc lwpcook
hth
t
------------------------------
Date: 31 Dec 2002 11:19:46 -0800
From: billzimmerman@gospellight.com (Bill)
Subject: Using perl to captuer IP of person submitting a form
Message-Id: <8da5f4f4.0212311119.39ecfa63@posting.google.com>
Does anyone know how to capture the IP of a user submitting a form,
and store that IP along with the data they submit?
Thanks,
Bill
------------------------------
Date: Tue, 31 Dec 2002 19:45:44 +0000
From: Gordan <gordan@_NOSPAM_bobich.net>
Subject: Re: Using perl to captuer IP of person submitting a form
Message-Id: <JtmQ9.39$X41.26130@newsfep2-gui>
Bill wrote:
> Does anyone know how to capture the IP of a user submitting a form,
> and store that IP along with the data they submit?
>
> Thanks,
>
> Bill
my $ClientIP = $ENV{"REMOTE_ADDR"};
HTH.
Gordan
------------------------------
Date: Tue, 31 Dec 2002 21:04:57 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Using perl to captuer IP of person submitting a form
Message-Id: <ZDnQ9.34259$Jb.22385@nwrddc02.gnilink.net>
Bill wrote:
> Does anyone know how to capture the IP of a user submitting a form,
> and store that IP along with the data they submit?
Why do you want to do that?
The IP doesn't tell you anything. It may be different with the next access
of the same person or it may be the same although it's a totally different
person this time.
jue
------------------------------
Date: Tue, 31 Dec 2002 21:13:20 +0100
From: smasr <isresi1@xs4all.nl>
Subject: whats the syntax to get a scalar out an array of references.
Message-Id: <3e11faa8$0$153$e4fe514c@dreader7.news.xs4all.nl>
Hi,
I try to read values out of a Lotus Notes Database. I read in the Lotus
Notes documentation that the function "GetItemValue" returns an array of 1
or more values. I am only interested in the first value as i know there is
only one value. Thats why i choose for $A (see code). Perhaps i better use
@A there and then something as @A[0] to get the value??
Anyway as the hours went by i realised that GetItemValue returns an Array
of memory references. But i am not sure i dont' understand the Perl errors
very well yet.
I have this and it works.
$A = $document->GetItemValue('Product');
my $tmp=\@A;
print @$A;
But now my question. How do i get the value in a normal scalar because i
needs the value to pass to another function.Also i think the code could be
improved but i don't know how ATM.
As i do not have Notes at home i made my own test case:
my @arr1=qw(1 2 3);
my @arr2=qw(3 4 5);
my $ref1=\@arr1;
my $ref2=\@arr2;
my @result=($ref1, $ref2); #@result has now two references to an array
#which has scalars.
how do i get the values 1 or 2 or 3 for example via @result in $tmp?
I tried several things but nothing seems to work.
my $tmp=@result[0][0]; <- nothing i tried seems to work.
my $tmp=@{result}[0]; <- nothing i tried seems to work.
my $tmp=@$$result; <- nothing i tried seems to work.
# and i tried on and on but i don't get the value.
------------------------------
Date: Tue, 31 Dec 2002 20:49:41 GMT
From: Darin McBride <dmcbride@naboo.to.org.no.spam.for.me>
Subject: Re: whats the syntax to get a scalar out an array of references.
Message-Id: <FpnQ9.328588$ka.8319677@news1.calgary.shaw.ca>
smasr wrote:
> I try to read values out of a Lotus Notes Database. I read in the Lotus
I didn't realise there was a perl interface to LN. Where did you get this?
I'd be somewhat curious as it could have saved me a lot of trouble at one
point...
> Notes documentation that the function "GetItemValue" returns an array of 1
> or more values. I am only interested in the first value as i know there is
> only one value. Thats why i choose for $A (see code). Perhaps i better use
> @A there and then something as @A[0] to get the value??
Standard perl answer: there are many ways to do it.
my @A = $document->GetItemValue('Product');
my $A = $A[0];
Or...
my $A = ($document->GetItemValue('Product'))[0];
(The outter parenthesis may not be required - I don't recall.)
> Anyway as the hours went by i realised that GetItemValue returns an Array
> of memory references. But i am not sure i dont' understand the Perl errors
> very well yet.
When I don't understand what's going on, I usually do something like this:
use Data::Dumper;
#...
print Dumper([$document->GetItemValue('Product')]);
Dumper prints out the same way that perl code looks in the first place. So
long as you can read perl, you can read its output. It may take some
getting used to, but it has managed to keep my hair from being pulled out
on more than one occassion. Of course, there are other ways to do this as
well - this is just the way I do it.
> I have this and it works.
>
> $A = $document->GetItemValue('Product');
> my $tmp=\@A;
> print @$A;
What does $tmp do in there? And where did @A come from? $A and @A are
different variables. You probably should take a good look at "perldoc
perldata".
> As i do not have Notes at home i made my own test case:
>
> my @arr1=qw(1 2 3);
> my @arr2=qw(3 4 5);
> my $ref1=\@arr1;
> my $ref2=\@arr2;
> my @result=($ref1, $ref2); #@result has now two references to an
> array
> #which has scalars.
>
> how do i get the values 1 or 2 or 3 for example via @result in $tmp?
> I tried several things but nothing seems to work.
>
> my $tmp=@result[0][0]; <- nothing i tried seems to work.
> my $tmp=@{result}[0]; <- nothing i tried seems to work.
> my $tmp=@$$result; <- nothing i tried seems to work.
> # and i tried on and on but i don't get the value.
Run "perldoc perldata" and read it. If you still don't get it, come back.
------------------------------
Date: 31 Dec 2002 13:03:13 -0800
From: Ethan Brown <ethan@draupnir.gso.saic.com>
Subject: Re: whats the syntax to get a scalar out an array of references.
Message-Id: <vrvg19nbou.fsf@draupnir.gso.saic.com>
>>>>> "smasr" == smasr <isresi1@xs4all.nl> writes:
smasr> Hi,
smasr> I try to read values out of a Lotus Notes Database. I read in the Lotus
[...]
smasr> my @arr1=qw(1 2 3);
smasr> my @arr2=qw(3 4 5);
smasr> my $ref1=\@arr1;
smasr> my $ref2=\@arr2;
smasr> my @result=($ref1, $ref2); #@result has now two references to an array
smasr> #which has scalars.
smasr> how do i get the values 1 or 2 or 3 for example via @result in $tmp?
smasr> I tried several things but nothing seems to work.
smasr> my $tmp=@result[0][0]; <- nothing i tried seems to work.
smasr> my $tmp=@{result}[0]; <- nothing i tried seems to work.
smasr> my $tmp=@$$result; <- nothing i tried seems to work.
smasr> # and i tried on and on but i don't get the value.
Try:
print "result[0][0] is " . $result[0]->[0] . "\n";
print "result[0][1] is " . $result[0]->[1] . "\n";
print "result[1][0] is " . $result[1]->[0] . "\n";
print "result[1][1] is " . $result[1]->[1] . "\n";
--Ethan Brown
--In a band? Use http://www.WheresTheGig.com for free.
------------------------------
Date: Tue, 31 Dec 2002 18:04:02 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: whats the syntax to get a scalar out an array of references.
Message-Id: <slrnb14c3i.9h2.tadmc@magna.augustmail.com>
smasr <isresi1@xs4all.nl> wrote:
> Anyway as the hours went by i realised that GetItemValue returns an Array
> of memory references.
An "array of references to arrays" is the more precise terminology.
> But i am not sure i dont' understand the Perl errors
> very well yet.
What error messages did you get?
Did you ask perl to explain them to you?
use diagnostics; # provide more verbose messages
> I have this and it works.
>
> $A = $document->GetItemValue('Product');
> my $tmp=\@A;
^^^^^^^^^^^^
That line does nothing useful.
You don't even _have_ an @A array until that statement.
$A and @A have absolutely nothing to do with each other, despite
their similar looking names. Perhaps you should review:
perldoc perldata
> print @$A;
>
>
> But now my question. How do i get the value in a normal scalar because i
> needs the value to pass to another function.
To figure out how to dereference the references you have gotten:
perldoc perlreftut
> As i do not have Notes at home i made my own test case:
That was a truly brilliant move, as it allows us without Notes
to give you concrete help.
Good thinking!
> my @arr1=qw(1 2 3);
> my @arr2=qw(3 4 5);
> my $ref1=\@arr1;
> my $ref2=\@arr2;
Now that you've perused perlreftut, you know that you can
rewrite that without the temporary array variables:
my $ref1 = [ qw(1 2 3) ];
my $ref2 = [ qw(3 4 5) ];
> my @result=($ref1, $ref2); #@result has now two references to an array
> #which has scalars.
>
> how do i get the values 1 or 2 or 3 for example via @result in $tmp?
> I tried several things but nothing seems to work.
>
> my $tmp=@result[0][0]; <- nothing i tried seems to work.
^
^
You should enable warnings.
That was pretty darn close though.
my $tmp = $result[0][0];
or
my $tmp = $result[0]->[0];
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
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 4328
***************************************