[28125] in Perl-Users-Digest
Perl-Users Digest, Issue: 9487 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jul 17 17:13:36 2006
Date: Mon, 17 Jul 2006 08:05:05 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Mon, 17 Jul 2006 Volume: 10 Number: 9487
Today's topics:
A subroutine for gcd <gamo@telecable.es>
Re: Can I compare array with array? <rvtol+news@isolution.nl>
Re: Can I compare array with array? <rvtol+news@isolution.nl>
debug won't work in Komodo 1.1. <jtpryan@gmail.com>
Extract alternate patterns harsha.ramanagoudra@gmail.com
Re: Extract alternate patterns <noreply@gunnar.cc>
Re: Extract alternate patterns <spam@bsb.me.uk>
Freeware IDE for perl? <jtpryan@gmail.com>
Re: Freeware IDE for perl? <sigzero@gmail.com>
Re: How get UTF-8 from urlencoded web form <flavell@physics.gla.ac.uk>
Re: How to local-ly close a handle? <bol@adv.magwien.gv.at>
Re: How to local-ly close a handle? <benmorrow@tiscali.co.uk>
Re: Net::Telnet - Library Application <joe@inwap.com>
Re: Net::Telnet - Library Application <rvtol+news@isolution.nl>
Re: Net::Telnet - Library Application <sgt19@tid.es>
Re: Net::Telnet - Library Application <sgt19@tid.es>
Re: Net::Telnet - Library Application <laff7430@bellsouth.net>
Re: Net::Telnet - Library Application <laff7430@bellsouth.net>
Re: Perl based free bulletin board system <jvs@india.ti.com>
Re: Perl equivalent of this script? <george.varsamopoulos@gmail.com>
Re: Perl equivalent of this script? <mritty@gmail.com>
Perl integrating with PHP wesley@ispace.co.za
Re: Perl integrating with PHP <noreply@gunnar.cc>
Problem with anonymous array in hash <bew_ba@gmx.net>
Re: Problem with anonymous array in hash <someone@example.com>
Re: Problem with anonymous array in hash <noreply@gunnar.cc>
Re: Problem with anonymous array in hash <bew_ba@gmx.net>
Re: What is a type error? <jo@durchholz.org>
When would you use qr// on a literal string? <simon.chao@fmr.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 17 Jul 2006 15:38:58 +0200
From: gamo <gamo@telecable.es>
Subject: A subroutine for gcd
Message-Id: <Pine.LNX.4.64.0607171536390.18789@jvz.es>
This message is in MIME format. The first part should be readable text,
while the remaining parts are likely unreadable without MIME-aware tools.
--8323328-1594627721-1153143538=:18789
Content-Type: TEXT/PLAIN; charset=ISO-8859-1
Content-Transfer-Encoding: QUOTED-PRINTABLE
Does anyone knows how to write a sub for gcd?
Any chances that will be include in the core like sort or like UBASIC?
TIA=20
--=20
http://www.telecable.es/personales/gamo/
S=F3lo hay 10 tipos de personas, las que saben binario y las que no
perl -e 'print 111_111_111**2,"\n";'
--8323328-1594627721-1153143538=:18789--
------------------------------
Date: Mon, 17 Jul 2006 12:25:41 +0200
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: Can I compare array with array?
Message-Id: <e9fvmu.r4.1@news.isolution.nl>
Paul Lalli schreef:
> In what situation do you
> believe the condition:
> @a - 1 == $#a
> to return a false value?
See jue's reply.
>>> my @a = qw(one two three);
>>> my @b = qw(one two three);
>>
>> perl -wle '
>> $, = qq/\t/;
>> @a = qw(a b c);
>> @b = (qq/a$"b$"c/);
>> print qq/@a/ eq qq/@b/, 0+@a, 0+@b
>> '
>
> What, exactly, are you attempting to prove here? That "@a" eq "@b" is
> not a good enough check to prove that @a and @b actually contain the
> same values? While I completely agree with you, I'm trying to figure
> out what that has to do with anything else you said.
I cut too much, this was above the "my @a = qw(one two three)"
>>> One can actually compare arrays for equality in a single statement
>>> if the contents of the arrays are simple strings or numbers
--
Affijn, Ruud
"Gewoon is een tijger."
------------------------------
Date: Mon, 17 Jul 2006 12:22:47 +0200
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: Can I compare array with array?
Message-Id: <e9fvmt.r4.1@news.isolution.nl>
Jürgen Exner schreef:
> Of course use of $[ is highly discouraged, but that doesn't mean that
> some people aren't stupid enough to try it nevertheless.
I happen to like arrays that don't have to start at 0. In Visual Basic I
used them a lot.
But it should be defined per array, not per file, so $[ary and $#ary.
AFAIK, Perl6 has it.
--
Affijn, Ruud
"Gewoon is een tijger."
------------------------------
Date: 17 Jul 2006 04:36:05 -0700
From: "jtpryan" <jtpryan@gmail.com>
Subject: debug won't work in Komodo 1.1.
Message-Id: <1153136165.494857.30320@m73g2000cwd.googlegroups.com>
I just got back into doing some perl coding. Previously I had used
Komodo 1.1 because it was free. So, I reinstalled it and got to work.
Problem is the debugger won't work. If I start it using "step in", the
status bar says the "debugger is running...". But then nothing else.
I can't step through it nor do I see any variable or other information.
I can't figure it out as it all worked before. Any ideas?
-JIm
------------------------------
Date: 17 Jul 2006 06:31:41 -0700
From: harsha.ramanagoudra@gmail.com
Subject: Extract alternate patterns
Message-Id: <1153143100.946263.284930@s13g2000cwa.googlegroups.com>
Hi all,
I am trying to extract alternate patterns in strings. The difficulty
is because of optional patterns.
Below is the code,$transaction is the search string.
if($transaction =~ /(addReq|modReq|subtractReq)+?.*?(addReq)?/){
print "$1..$2\n";
}
The above code is succeeding to match the first pattern but always
fails to match the optional second addReq. The output I get is
addReq..
My intention is that this search extracts patterns like those below. In
some cases $2 may be undef
addReq
addReq..addReq
modReq..addReq
subtractReq
Thanks
Harsha
------------------------------
Date: Mon, 17 Jul 2006 16:10:21 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Extract alternate patterns
Message-Id: <4i1jvnF1mt6jU1@individual.net>
harsha.ramanagoudra@gmail.com wrote:
> I am trying to extract alternate patterns in strings. The difficulty
> is because of optional patterns.
>
> Below is the code,$transaction is the search string.
>
> if($transaction =~ /(addReq|modReq|subtractReq)+?.*?(addReq)?/){
> print "$1..$2\n";
> }
>
> The above code is succeeding to match the first pattern but always
> fails to match the optional second addReq. The output I get is
>
> addReq..
One idea:
/(addReq|modReq|subtractReq)(?:.*(?=addReq)|.*)(addReq)?/
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: 17 Jul 2006 14:29:45 GMT
From: Ben Bacarisse <spam@bsb.me.uk>
Subject: Re: Extract alternate patterns
Message-Id: <44bb9ed9$0$10937$fa0fcedb@news.zen.co.uk>
harsha.ramanagoudra@gmail.com wrote:
> Hi all,
> I am trying to extract alternate patterns in strings. The difficulty
> is because of optional patterns.
<snip>
> if($transaction =~ /(addReq|modReq|subtractReq)+?.*?(addReq)?/){
> print "$1..$2\n";
> }
>
<snip>
> The output I get is
>
> addReq..
>
> My intention is that this search extracts patterns like those below. In
> some cases $2 may be undef
>
> addReq
> addReq..addReq
> modReq..addReq
The above is matched as three parts:
"modReq" by (addReq|modReq|subtractReq)+
"..addReq" by .*
"" by (addReq)
There are several fixes, but the simplest would be to be more
restrictive than .* in the middle part.
--
Ben.
------------------------------
Date: 17 Jul 2006 04:37:35 -0700
From: "jtpryan" <jtpryan@gmail.com>
Subject: Freeware IDE for perl?
Message-Id: <1153136255.591399.69120@i42g2000cwa.googlegroups.com>
Can anybody recommend good ones?
Thanks,
Jim
------------------------------
Date: 17 Jul 2006 05:42:01 -0700
From: "Robert Hicks" <sigzero@gmail.com>
Subject: Re: Freeware IDE for perl?
Message-Id: <1153140121.551915.15340@m79g2000cwm.googlegroups.com>
Vim
emacs
XEmacs
SciTE
Open Perl IDE
The Crimson Editor
ConTEXT
CPad
Spend a little $$:
Komodo
Textmate
Affrus
All depends on what *you* are looking for and what OS *you* are on.
Some of those are Linux, some are Windows, some are OSX and some are
x-platform.
:Robert
------------------------------
Date: Mon, 17 Jul 2006 12:58:25 +0100
From: "Alan J. Flavell" <flavell@physics.gla.ac.uk>
Subject: Re: How get UTF-8 from urlencoded web form
Message-Id: <Pine.LNX.4.64.0607171248010.2685@ppepc20.ph.gla.ac.uk>
On Sun, 16 Jul 2006, John W. Kennedy wrote:
> "\n" is 0x0A on all systems.
Not so. http://perldoc.perl.org/perlport.html#Newlines
Check, at least, Macs and EBCDIC-based platforms.
> However, when writing a file in text mode, 0x0A may be translated on
> the file into 0x0D,an 0x0D0A, or (on an IBM mainframe) a logical
> record end. Similarly, an 0x0D, an 0x0D0A, or a logical record end
> can be translated into an 0x0A when reading a file in text mode.
That seems to me a very confuddling way of trying to convince oneself
that \n is always 0x0A - even though, on some platforms, your
hypothetical 0x0A never really exists, other than in the mind. I'd
prefer the explanation set out in perlport.
------------------------------
Date: Mon, 17 Jul 2006 12:46:05 +0200
From: "Ferry Bolhar" <bol@adv.magwien.gv.at>
Subject: Re: How to local-ly close a handle?
Message-Id: <1153133166.752961@proxy.dienste.wien.at>
Ben Morrow:
> The fd you closed will remain closed, but the Perl filehandle will
> revert to pointing to its old fd, and thus will be open again. :)
But the OP wrote:
>...then STDERR *is* finally silenced, but it *remains* silenced outside
> of the block (e.g. the message from the die statement doesn't show);
> i.e. the closing is not localized.
So, this contradicts what you said above, doesn't it?
Greetings, Ferry
--
Ing. Ferry Bolhar
Municipality of Vienna, Department 14
A-1010 Vienna / AUSTRIA
E-mail: bol@adv.magwien.gv.at
------------------------------
Date: Mon, 17 Jul 2006 14:10:13 +0100
From: Ben Morrow <benmorrow@tiscali.co.uk>
Subject: Re: How to local-ly close a handle?
Message-Id: <lqeso3-pfv.ln1@osiris.mauzo.dyndns.org>
Quoth "Ferry Bolhar" <bol@adv.magwien.gv.at>:
> Ben Morrow:
>
> > The fd you closed will remain closed, but the Perl filehandle will
> > revert to pointing to its old fd, and thus will be open again. :)
...unless you've closed the old fd as well in the meantime.
> But the OP wrote:
>
> >...then STDERR *is* finally silenced, but it *remains* silenced outside
> > of the block (e.g. the message from the die statement doesn't show);
> > i.e. the closing is not localized.
>
> So, this contradicts what you said above, doesn't it?
The OP's example was
local *STDERR = *STDERR;
so in this case old fd == new fd, and obviously closing one closes the
other.
Ben
--
Outside of a dog, a book is a man's best friend.
Inside of a dog, it's too dark to read.
benmorrow@tiscali.co.uk Groucho Marx
------------------------------
Date: Mon, 17 Jul 2006 03:04:37 -0700
From: Joe Smith <joe@inwap.com>
Subject: Re: Net::Telnet - Library Application
Message-Id: <QtOdnSGwF5tw_SbZnZ2dnUVZ_oGdnZ2d@comcast.com>
Stephan Titard wrote:
> robic0 escribió:
>> 759 lines
>
> I have used for years the telnet module and never experienced any problem
Did you _HAVE_ to quote the entire article? All 759 lines of it?
------------------------------
Date: Mon, 17 Jul 2006 12:38:31 +0200
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: Net::Telnet - Library Application
Message-Id: <e9g11f.124.1@news.isolution.nl>
Carl Lafferty schreef:
>> ($info) = $galaxy->waitfor('/\\\b/');
>
> worked like a charm!!
> Thank you!!!!!!!
You're welcome. In the mean time I have read some of the documentation
of the module, which says that you can give either a string or a regex
to waitfor(). If the extra interpolation only happens with regexes, just
waitfor("\x5C\x62") might work as well.
--
Affijn, Ruud
"Gewoon is een tijger."
------------------------------
Date: Mon, 17 Jul 2006 12:44:46 +0200
From: Stephan Titard <sgt19@tid.es>
Subject: Re: Net::Telnet - Library Application
Message-Id: <e9fpmt$suf11@news.hi.inet>
Joe Smith escribió:
> Stephan Titard wrote:
>> robic0 escribió:
>>> 759 lines
>>
>> I have used for years the telnet module and never experienced any problem
>
> Did you _HAVE_ to quote the entire article? All 759 lines of it?
Sorry, I did not even notice there was so much code in there. I usually
keep all of the context (and I have my newsgroup client setup this way
actually, which I realize is not a good idea...will need something better)
does this also mean I should not post 2*759 code lines?
I mean no flame here, your *post* actually made me think and I browsed
through the guidelines but did not find anything related to size
it could be also that in general posting too much code is a bad idea
common sense should apply, I guess
hth
--stephan
------------------------------
Date: Mon, 17 Jul 2006 13:26:21 +0200
From: Stephan Titard <sgt19@tid.es>
Subject: Re: Net::Telnet - Library Application
Message-Id: <e9fs4u$sul7@news.hi.inet>
Carl Lafferty escribió:
>>
>> ($info) = $galaxy->waitfor(qr/\x5C\x62/);
>>
>> Or try:
>> ($info) = $galaxy->waitfor('/\\\b/');
>>
> Couldn't get the top one to work BUT the bottom one worked like a charm!!
>
> Thank you!!!!!!!
>
>
Just a small remark. The *Net::Telnet* module has a lot of
functionality, but when it comes to automate an interactive program I
think *expect* first. *expect* uses pseudo-terminals so this may be a
limitation on some platforms.
A pure perl clone exists as module *Expect*.
hth
--stephan
------------------------------
Date: Mon, 17 Jul 2006 09:57:00 -0400
From: Carl Lafferty <laff7430@bellsouth.net>
Subject: Re: Net::Telnet - Library Application
Message-Id: <6GMug.13038$cu1.9157@bignews3.bellsouth.net>
>>
> Just a small remark. The *Net::Telnet* module has a lot of
> functionality, but when it comes to automate an interactive program I
> think *expect* first. *expect* uses pseudo-terminals so this may be a
> limitation on some platforms.
> A pure perl clone exists as module *Expect*.
>
I will give that a try. thanks.
------------------------------
Date: Mon, 17 Jul 2006 10:05:28 -0400
From: Carl Lafferty <laff7430@bellsouth.net>
Subject: Re: Net::Telnet - Library Application
Message-Id: <3OMug.13085$cu1.11192@bignews3.bellsouth.net>
>
> anyway, if you believe your wrapper may serve others you could contact
> the author to have your code added in the example section for example
> just a thought
> hth
> --stephan
>
Right now *my* code is almost embarrassing. I intend to try the other
code when I get a chance. Right now I am wanting to get something to
prove the concept so that I can devote some more time to it.
I am having another problem however, NOW (remember this is a reverse
engineering thing here) I have to accept a set length of characters from
the server I am contacting.
Let me stress something about the server I am using. it is running on a
non standard port (2001) no problem there and was originally intended to
be used interactively with a terminal program. the server runs under
VMS something I have little or NO experience with beyond simple things
like deleting processes and starting my library automation software with
it. The company kludged together a windows interface a few years later
when 98 became popular (yea it is that old) but it does not rely on a
single 'prompt' from the data packets I have captured. there are
delimiters (\x8f as well as the \b (those chars not a backspace)) but
insofar as I can see when their software talks to the server, there are
no prompts.
------------------------------
Date: Mon, 17 Jul 2006 17:06:00 +0530
From: Jahagirdar Vijayvithal S <jvs@india.ti.com>
Subject: Re: Perl based free bulletin board system
Message-Id: <e9fsn0$mc4$1@home.itg.ti.com>
try YaBB
* Ignoramus14396 <ignoramus14396@NOSPAM.14396.invalid> wrote:
> I am looking for perl based bulletin board system, with good safety
> and security track record. Perl/Apache/MySQL or filesystem
> storage. Any suggestions will be appreciated.
>
> i
>
Regards
Jahagirdar Vijayvithal S
------------------------------
Date: 17 Jul 2006 04:11:30 -0700
From: "george.varsamopoulos@gmail.com" <george.varsamopoulos@gmail.com>
Subject: Re: Perl equivalent of this script?
Message-Id: <1153134690.667166.222290@m79g2000cwm.googlegroups.com>
Tad McClellan wrote:
> george.varsamopoulos@gmail.com <george.varsamopoulos@gmail.com> wrote:
>
> > i didn't find
>
>
> You didn't even look in the Perl FAQ? That's not very nice.
>
> perldoc -q HTML
>
> How do I fetch an HTML file?
>
I tried to "google" for it, believing that it would return hits from
the FAQ as well. Apparently, wording it "how to..." and not "how do
I..." did not hit the FAQ. I found some solutions, however not as
concise as the ones in the FAQ.
All in all, thank you for your help, and I appreciate your feedback.
--George
------------------------------
Date: 17 Jul 2006 07:09:54 -0700
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: Perl equivalent of this script?
Message-Id: <1153145394.255893.133280@m79g2000cwm.googlegroups.com>
george.varsamopoulos@gmail.com wrote:
> Tad McClellan wrote:
> > You didn't even look in the Perl FAQ? That's not very nice.
> I tried to "google" for it, believing that it would return hits from
> the FAQ as well. Apparently, wording it "how to..." and not "how do
> I..." did not hit the FAQ. I found some solutions, however not as
> concise as the ones in the FAQ.
Allow me to suggest that when looking for assistance with Perl, Google
be your *last* resort, not your first. The PerlFAQ and other
documentation have their own web-based interface if you dislike the
command line or just like searching online. Have a look at
http://perldoc.perl.org
Paul Lalli
------------------------------
Date: 17 Jul 2006 05:03:02 -0700
From: wesley@ispace.co.za
Subject: Perl integrating with PHP
Message-Id: <1153137782.095686.108860@b28g2000cwb.googlegroups.com>
Hi All, can i send variables from a php script into a perl script? If
so, how?
Thanks Wes
------------------------------
Date: Mon, 17 Jul 2006 15:04:04 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Perl integrating with PHP
Message-Id: <4i1g3dF1n43gU1@individual.net>
wesley@ispace.co.za wrote:
> Hi All, can i send variables from a php script into a perl script?
Probably not.
But you can pass data via an HTTP GET or POST request or via a
(temporary) file.
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: 17 Jul 2006 03:38:46 -0700
From: "bernd" <bew_ba@gmx.net>
Subject: Problem with anonymous array in hash
Message-Id: <1153132726.849564.185570@75g2000cwc.googlegroups.com>
Hello netties,
probably the solution is quite simple, but obviously I am blocked
currently concerning the following:
perl -e '@somearr=split(/ /,"11 12 13"); $hash{'array1'}->[0]=50;
$hash{'array1'}->[2]=100;printf("%d\n", scalar(@somearr));
printf("%d\n",
scalar(@$hash{'array1'}))'
Running this on the command line gives:
3
0
The first number is, as expected, the number of elements in the array
since evaluating an array in scalar context gives it's number of
elements. I would have expected "2" as the outcome for the second,
anonymous array stored in the hash, but obviously I am not referencing
to the array, or?
What am I doing wrong?
Cheers
Bernd
------------------------------
Date: Mon, 17 Jul 2006 10:54:54 GMT
From: "John W. Krahn" <someone@example.com>
Subject: Re: Problem with anonymous array in hash
Message-Id: <20Kug.50345$B91.9966@edtnps82>
bernd wrote:
>
> probably the solution is quite simple, but obviously I am blocked
> currently concerning the following:
>
> perl -e '@somearr=split(/ /,"11 12 13"); $hash{'array1'}->[0]=50;
> $hash{'array1'}->[2]=100;printf("%d\n", scalar(@somearr));
> printf("%d\n",
> scalar(@$hash{'array1'}))'
>
> Running this on the command line gives:
>
> 3
> 0
>
> The first number is, as expected, the number of elements in the array
> since evaluating an array in scalar context gives it's number of
> elements. I would have expected "2" as the outcome for the second,
> anonymous array stored in the hash, but obviously I am not referencing
> to the array, or?
>
> What am I doing wrong?
If you had enabled warnings perl would have given you a hint:
$ perl -we'
@somearr = ( 11, 12, 13 );
$hash{ array1 }[ 0 ] = 50;
$hash{ array1 }[ 2 ] = 100;
printf "%d\n", scalar @somearr;
printf "%d\n", scalar @$hash{ array1 };
'
3
Use of uninitialized value in printf at -e line 6.
0
The problem is that you are dereferencing $hash when you should be
dereferencing $hash{ array1 } like so:
printf "%d\n", scalar @{ $hash{ array1 } };
perldoc perlref
John
--
use Perl;
program
fulfillment
------------------------------
Date: Mon, 17 Jul 2006 13:00:55 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Problem with anonymous array in hash
Message-Id: <4i18shF1lte0U1@individual.net>
bernd wrote:
>
> perl -e '@somearr=split(/ /,"11 12 13"); $hash{'array1'}->[0]=50;
> $hash{'array1'}->[2]=100;printf("%d\n", scalar(@somearr));
> printf("%d\n",
> scalar(@$hash{'array1'}))'
>
> Running this on the command line gives:
>
> 3
> 0
>
> The first number is, as expected, the number of elements in the array
> since evaluating an array in scalar context gives it's number of
> elements. I would have expected "2" as the outcome for the second,
> anonymous array stored in the hash, but obviously I am not referencing
> to the array, or?
>
> What am I doing wrong?
You are breaking The Golden Rule for debugging Perl code:
perldoc -q debug
Don't post buggy code here without first letting Perl help you fix it by
enabling strictures and warnings.
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: 17 Jul 2006 04:04:28 -0700
From: "bernd" <bew_ba@gmx.net>
Subject: Re: Problem with anonymous array in hash
Message-Id: <1153134268.266193.254530@p79g2000cwp.googlegroups.com>
Thanks John, sometimes I am too concise with my code and omit things
which should not be omitted, e.g. braces ;-)
John W. Krahn wrote:
> bernd wrote:
> >
> > probably the solution is quite simple, but obviously I am blocked
> > currently concerning the following:
> >
> > perl -e '@somearr=split(/ /,"11 12 13"); $hash{'array1'}->[0]=50;
> > $hash{'array1'}->[2]=100;printf("%d\n", scalar(@somearr));
> > printf("%d\n",
> > scalar(@$hash{'array1'}))'
> >
> > Running this on the command line gives:
> >
> > 3
> > 0
> >
> > The first number is, as expected, the number of elements in the array
> > since evaluating an array in scalar context gives it's number of
> > elements. I would have expected "2" as the outcome for the second,
> > anonymous array stored in the hash, but obviously I am not referencing
> > to the array, or?
> >
> > What am I doing wrong?
>
> If you had enabled warnings perl would have given you a hint:
>
> $ perl -we'
> @somearr = ( 11, 12, 13 );
> $hash{ array1 }[ 0 ] = 50;
> $hash{ array1 }[ 2 ] = 100;
> printf "%d\n", scalar @somearr;
> printf "%d\n", scalar @$hash{ array1 };
> '
> 3
> Use of uninitialized value in printf at -e line 6.
> 0
>
> The problem is that you are dereferencing $hash when you should be
> dereferencing $hash{ array1 } like so:
>
> printf "%d\n", scalar @{ $hash{ array1 } };
>
>
> perldoc perlref
>
>
>
> John
> --
> use Perl;
> program
> fulfillment
------------------------------
Date: Mon, 17 Jul 2006 12:23:01 +0200
From: Joachim Durchholz <jo@durchholz.org>
Subject: Re: What is a type error?
Message-Id: <e9fonb$cga$1@online.de>
Rob Warnock schrieb:
> Joachim Durchholz <jo@durchholz.org> wrote:
> +---------------
> | INSERT cannot be expressed in terms of assignment. INSERT creates a new
> | record; there's no way that assignment in a language like C can create a
> | new data structure! The same goes for DELETE.
> +---------------
>
> Well, what about "malloc()" & "free()"?
These do exactly what assignment cannot do.
The correspondence between SQL and C would be:
INSERT - malloc() (create a new data structure)
DELETE - free() (destroy a data structure)
UPDATE - assignment (change data within a data structure)
Regards,
Jo
------------------------------
Date: 17 Jul 2006 07:07:31 -0700
From: "it_says_BALLS_on_your forehead" <simon.chao@fmr.com>
Subject: When would you use qr// on a literal string?
Message-Id: <1153145251.119197.122300@35g2000cwc.googlegroups.com>
I thought that qr was mainly used for pre-compiling variables into
regex patterns, but a colleague uses it like so:
my ( $name, $value ) = split qr/=/, $string;
Are there any benefits to doing this? He claims that the use of the
qr// op here can help capture an error if the STRING is not a valid
regex. Does this make any sense?
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc. For subscription or unsubscription requests, send
#the single line:
#
# subscribe perl-users
#or:
# unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.
#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 9487
***************************************