[28563] in Perl-Users-Digest
Perl-Users Digest, Issue: 9927 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Nov 3 11:05:45 2006
Date: Fri, 3 Nov 2006 08:05:06 -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 Fri, 3 Nov 2006 Volume: 10 Number: 9927
Today's topics:
ADSI through Win32::OLE damien.chaumette@gmail.com
Re: Calling Perl program from Java Script and populatin <tadmc@augustmail.com>
Re: Calling Perl program from Java Script and populatin xhoster@gmail.com
Re: Data plotting questions Nov. 2, 2006 <zentara@highstream.net>
Re: exit a Net:telnet connection <pdc124@yahoo.co.uk>
Re: Getting huge data into memory in perl <rahul.thathoo@gmail.com>
Re: Getting huge data into memory in perl anno4000@radom.zrz.tu-berlin.de
Re: Getting huge data into memory in perl xhoster@gmail.com
I sat, thought about this, and I still don't understand <cdalten@gmail.com>
Re: I sat, thought about this, and I still don't unders <hjp-usenet2@hjp.at>
Re: Masking/Hiding a password in Perl Source <Peter@PSDT.com>
Re: Masking/Hiding a password in Perl Source <sigzero@gmail.com>
Re: Perl equivalent to unix script <rvtol+news@isolution.nl>
Re: Perl equivalent to unix script <hjp-usenet2@hjp.at>
Scapy in Perl: Scaperl <sylvain.sarmejeanne.ml@gmail.com>
Re: Sorting and Writing Effecient Code xhoster@gmail.com
Re: Sorting and Writing Effecient Code <peace.is.our.profession@gmx.de>
Re: SQLPlus with Perl <Peter@PSDT.com>
Re: submitting a form with no name attribute with mecha <glex_no-spam@qwest-spam-no.invalid>
Re: understanding an error anno4000@radom.zrz.tu-berlin.de
Re: understanding an error <bik.mido@tiscalinet.it>
Re: WWW::Mechanize - simulating complete page download <mark.clementsREMOVETHIS@wanadoo.fr>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 3 Nov 2006 07:34:30 -0800
From: damien.chaumette@gmail.com
Subject: ADSI through Win32::OLE
Message-Id: <1162568070.532281.57560@h54g2000cwb.googlegroups.com>
Hi, I need to be able to deploy an IIS configuration using a perl
script.
Therefore I've been looking into Win32::OLE, which allowed me to Dump
my config and make changes to the existing keys.
Now my problem is that I can't create a new Object or a new Property,
I've been looking around and found that piece of VB code:
Set IIsWebVDirRootObj = GetObject("IIS://localhost/W3SVC/1/Root")
Set IIsWebVDirObj = IIsWebVDirRootObj.Create("IIsWebVirtualDir",
"NewVDir")
Which successully created a new Object in my tree whereas the same code
in Perl left the tree unchanged (without warning nor error):
my $root = Win32::OLE->GetObject("IIS://localhost/W3SVC/1/Root");
my $o = $root->Create("IIsWebVirtualDir", "ReallyNewVDir");
Any ideas or suggestions?
Thanks,
Damien
------------------------------
Date: Fri, 3 Nov 2006 05:54:30 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Calling Perl program from Java Script and populating the list boxes
Message-Id: <slrnekmbfm.u1i.tadmc@tadmc30.august.net>
alwaysonnet <kalyanrajsista@gmail.com> wrote:
> Question 1 - Is it possible to call a perl subroutine from Javascript ?
No.
But it is possible for Javascript to issue an HTTP request and the
destination server can write the code to handle that request in
just about any programming language, including Perl.
> Question 2 - Please provide an idea of how to build dynamic list boxes
> using Javascript.
This is the Perl newsgroup.
The Javascript newsgroup is over thataway ==>
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 03 Nov 2006 14:59:32 GMT
From: xhoster@gmail.com
Subject: Re: Calling Perl program from Java Script and populating the list boxes
Message-Id: <20061103100001.330$Qm@newsreader.com>
"alwaysonnet" <kalyanrajsista@gmail.com> wrote:
> Hi all,
>
> Question 1 - Is it possible to call a perl subroutine from Javascript ?
Not directly, ordinarily. Indirectly, sure.
...
>
> But i need to populate the destinations from the database everytime i
> select the origin from the listbox 1. Simply saying that I can't
> hardcode the origin and destination arrays , as i need to get them from
> the database...
The fact that you need to get them the database does not preclude you from
doing what you call "hardcoding". You would merely have to make Perl write
the "hardcoded" javascript. Maybe there are other reasons not to
"hardcode" them, but this isn't one of them.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
------------------------------
Date: Fri, 03 Nov 2006 14:16:44 GMT
From: zentara <zentara@highstream.net>
Subject: Re: Data plotting questions Nov. 2, 2006
Message-Id: <ijjmk29v74v1jjj68ubq3mtr2a83jkb8rk@4ax.com>
On Fri, 03 Nov 2006 02:30:52 GMT, "edgrsprj" <edgrsprj@ix.netcom.com>
wrote:
>Data Plotting Questions: November 2, 2006
>
>1. What commands etc. can be used to have Perl generate simple two
>dimensional x - y data plots from an array such as $data[$x,$y]?
>
>2. Does an additional graphics module have to be installed?
>
>3. When a plot is generated like that, how can it be stored as a GIF or BMP
>file? If all else failed I could probably generate the plot and do a screen
>capture and store it that way.
>
>If someone can provide enough information regarding how to get started on
>this then I should be able to do whatever reading is necessary and fill in
>the details myself.
>
Perl/Tk would be the easiest. If you are on Windows, Tk comes with
ActiveStatePerl. On linux, just get Tk from cpan and build it.
Once installed, run "widget" which is the Tk demo. Look under the
section "Canvases -- A Simple 2-D plot"
It shows how to do the plot, and save to a postscript file.
--
I'm not really a human, but I play one on earth.
http://zentara.net/japh.html
------------------------------
Date: 3 Nov 2006 07:44:57 -0800
From: "pdc124@yahoo.co.uk" <pdc124@yahoo.co.uk>
Subject: Re: exit a Net:telnet connection
Message-Id: <1162568697.746352.46870@f16g2000cwb.googlegroups.com>
($names)=$t2->waitfor('/Main Index Details/');
print $names;print $q-> hr;
do
{$t2->print('0');
my ($names2)=$t2->waitfor('/Main Index Details/');
$names=$names.$names2;
print $names;print $q-> hr;
}
until ($names=~/No\s+more/);
#print $names;print $q-> hr;
retrieves each screen of information and adds it to $ names and prints
it out
/tmp/outputlog shows that ( in this case) 4 '0's are sent
/tmp/dumpfile captures the 'No more previous.....' text that flashes
on the screen when you reach the last screen that i want to capture
< 0x000b0: 65 6e 64 61 6e 63 65 1b 5b 32 32 3b 31 38 48 5b
endance.[22;18H[
< 0x000c0: 20 5d 1b 5b 32 34 3b 31 48 1b 5b 4b 1b 5b 32 32
].[24;1H.[K.[22
< 0x000d0: 3b 31 39 48 20 5d 1b 5b 32 32 3b 31 39 48 30 1b ;19H
].[22;19H0.
< 0x000e0: 5b 32 32 3b 32 30 48 1b 5b 32 34 3b 31 48 1b 5b
[22;20H.[24;1H.[
> 0x00000: 30 0d 0a 0..
< 0x00000: 4b 1b 5b 32 34 3b 32 31 48 07 4e 6f 20 6d 6f 72
K.[24;21H.No mor
< 0x00010: 65 20 70 72 65 76 69 6f 75 73 20 68 6f 73 70 69 e
previous hospi
< 0x00020: 74 61 6c 20 61 74 74 65 6e 64 61 6e 63 65 73 tal
attendances
< 0x00000: 1b 5b .[
< 0x00000: 32 34 3b 32 31 48 1b 5b 4b 1b 5b 32 32 3b 31 38
24;21H.[K.[22;18
< 0x00010: 48 5b 20 5d 1b 5b 32 34 3b 31 48 1b 5b 4b 1b 5b H[
].[24;1H.[K.[
< 0x00020: 32 32 3b 31 39 48 20 5d 1b 5b 32 32 3b 31 39 48 22;19H
].[22;19H
the end of inputlog ( different hexeditor beacuse catting it gives the
formatted output)
2510 3b 32 30 48 1b 5b 32 34 3b 31 48 1b 5b 4b 1b 5b ;20H.[24
;1H.[K.[
2520 32 34 3b 32 31 48 07 4e 6f 20 6d 6f 72 65 20 70 24;21H.N o more
p
2530 72 65 76 69 6f 75 73 20 68 6f 73 70 69 74 61 6c revious
hospital
2540 20 61 74 74 65 6e 64 61 6e 63 65 73 1b 5b 32 34 attenda
nces.[24
2550 3b 32 31 48 1b 5b 4b 1b 5b 32 32 3b 31 38 48 5b ;21H.[K.
[22;18H[
2560 20 5d 1b 5b 32 34 3b 31 48 1b 5b 4b 1b 5b 32 32 ].[24;1
H.[K.[22
2570 3b 31 39 48 20 5d 1b 5b 32 32 3b 31 39 48 ;19H ].[ 22;19H
but the text hasnt appeared on the end of $names ;
------------------------------
Date: 3 Nov 2006 03:08:57 -0800
From: "rahulthathoo" <rahul.thathoo@gmail.com>
Subject: Re: Getting huge data into memory in perl
Message-Id: <1162552137.279253.17580@h48g2000cwc.googlegroups.com>
That actually works fine. My problem is that I want to store each file
as a part of an associative array. I am not able to do that. the first
part of the associative array should be the name of the file and the
second part should be the entire file itself? Is there a way to do
this?
Rahul
Dr.Ruud wrote:
> rahulthathoo schreef:
>
> > open A, $mov_i || die "Shit there is some prob here $!";
>
> Wrong or-operator or some () missing.
> See perlopentut.
>
> --
> Affijn, Ruud
>
> "Gewoon is een tijger."
------------------------------
Date: 3 Nov 2006 11:24:49 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: Getting huge data into memory in perl
Message-Id: <4r0n81Fov98sU2@news.dfncis.de>
rahulthathoo <rahul.thathoo@gmail.com> wrote in comp.lang.perl.misc:
[top posting corrected. please don't do that]
> Dr.Ruud wrote:
> > rahulthathoo schreef:
> >
> > > open A, $mov_i || die "Shit there is some prob here $!";
> >
> > Wrong or-operator or some () missing.
> > See perlopentut.
> That actually works fine.
No, it doesn't. The code will only ever die when $mov_i contains a
boolean false value. It doesn't catch a failed open() as intended.
Learn to test your code.
> My problem is that I want to store each file
> as a part of an associative array. I am not able to do that. the first
> part of the associative array should be the name of the file and the
> second part should be the entire file itself? Is there a way to do
> this?
See $/ in perlvar, look for "slurp mode". Also see the CPAN module
File::Slurp.
The code in your OP catches only one line because you're only looping
once:
for($var=1;$var<2; $var++)
Anno
Anno
------------------------------
Date: 03 Nov 2006 15:05:05 GMT
From: xhoster@gmail.com
Subject: Re: Getting huge data into memory in perl
Message-Id: <20061103100534.415$iv@newsreader.com>
"rahulthathoo" <rahul.thathoo@gmail.com> wrote:
> Hi
>
> I have a huge data set with me. Its like over 10000 files each with
> average 50KB of data. Assuming I have sufficient RAM, i need to be able
> to load all this into memory so that when i have to look for it I dont
> have to do an I/O. How do I go about this whole process in perl.
Generally, you don't. File system caching is a job for your OS, not for
Perl. If you load everything into (virtual) memory, some of it will
probably get paged out anyway, meaning you still need I/O to get at it.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
------------------------------
Date: 3 Nov 2006 05:45:35 -0800
From: "grocery_stocker" <cdalten@gmail.com>
Subject: I sat, thought about this, and I still don't understand it.
Message-Id: <1162561535.143306.42640@m7g2000cwm.googlegroups.com>
The following code is taken from perltooc
#!/usr/bin/perl -w
package Some_Class;
use strict;
our %ClassData = (
CData1 => "",
CData2 => "",
);
print "keys: " , keys %ClassData , "\n";
for my $datum (keys %ClassData) {
print "Datum values are: $datum \n";
print "Shit in global array: @_ \n";
no strict "refs";
*datum = sub {
#shift;
my $class = shift;
print "The class is: $class \n";
print "The value of datum is now: $datum \n";
$ClassData{$datum} = shift if @_;
print "values:" , $ClassData{$datum} , "\n";
print "The glob is: ", *datum , "\n";
print "The value of datum again is: ", $datum , "\n";
return $ClassData{$datum};
}
}
#print "The glob is: ", *datum , "\n";
package main;
no strict "refs";
#$Some_Class::CData1 = "test";
#my $first_value = Some_Class->datum("test");
#print "The value in main is: $first_value \n";
1)When I run the code; I get the following:
keys: CData2CData1
Datum values are: CData2
Shit in global array:
Datum values are: CData1
Shit in global array:
Subroutine Some_Class::datum redefined at ./att.pl line 33.
I'm not too sure how the subroutine gets redefined.
2)How do I invoke the method?
There are a few other things that are murky, but these are the two
major issues.
Chad
------------------------------
Date: Fri, 3 Nov 2006 16:15:50 +0100
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: I sat, thought about this, and I still don't understand it.
Message-Id: <slrnekmn96.g7v.hjp-usenet2@yoyo.hjp.at>
On 2006-11-03 13:45, grocery_stocker <cdalten@gmail.com> wrote:
> The following code is taken from perltooc
Not quite. You made a small but crucial error in copying the code.
> Subroutine Some_Class::datum redefined at ./att.pl line 33.
>
> I'm not too sure how the subroutine gets redefined.
So you should have a closer look at that line.
hp
--
_ | Peter J. Holzer | > Wieso sollte man etwas erfinden was nicht
|_|_) | Sysadmin WSR | > ist?
| | | hjp@hjp.at | Was sonst wäre der Sinn des Erfindens?
__/ | http://www.hjp.at/ | -- P. Einstein u. V. Gringmuth in desd
------------------------------
Date: Fri, 03 Nov 2006 14:05:33 GMT
From: Peter Scott <Peter@PSDT.com>
Subject: Re: Masking/Hiding a password in Perl Source
Message-Id: <pan.2006.11.03.14.05.32.511080@PSDT.com>
On Thu, 02 Nov 2006 11:55:41 -0800, Chris G. wrote:
> These are good suggestions. A little more information may help. The
> whole point of the protecting the password within the source code is to
> quiet the nay-sayers in my department who will scream bloody-murder
> because anyone can read the password. Never mind that the connections we
> make are using telnet, which is unsecure by default. I was considering
> even a simple ROT13 call to jumble it.
Oh. I was going to suggest kerberizing the application and then using a
keytab file for authentication. Of course, anyone who snarfs the keytab
file can still perform any operation as that principal they want, with the
exception that they cannot discover or change the password. Sounds like
you'd be okay with just reading the password off a local disk file with
minimal permissions.
> I am not opposed to reading an encrypted string from a file and decrypting
> it. I'm just trying to satisfy people on a more political level than a
> technical level, if that makes sense.
>
> Thanks for the suggestions and keep them coming!
--
Peter Scott
http://www.perlmedic.com/
http://www.perldebugged.com/
------------------------------
Date: 3 Nov 2006 07:55:26 -0800
From: "Robert Hicks" <sigzero@gmail.com>
Subject: Re: Masking/Hiding a password in Perl Source
Message-Id: <1162569326.427843.323520@e3g2000cwe.googlegroups.com>
As other have answered there really isn't "a" solution to this. I make
myself feel better by using the unpack command in my script.
my $password = unpack "u", qq{&<&QE87-E};
Sure that isn't any better than any other solution but it isn't "plain"
text either and that was all I was trying to solve. You could probably
do some silly obfuscation on it too.
Robert
------------------------------
Date: Fri, 3 Nov 2006 13:55:11 +0100
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: Perl equivalent to unix script
Message-Id: <eifhtq.8o.1@news.isolution.nl>
Dan Mercer schreef:
> Dr.Ruud:
>> Dan Mercer:
>>> usenet:
>>>> Mike:
>>>>> cat tempfile1 | sort > newfile2;
>>>>
>>>> That's rather convoluted even for UNIX scripting. Why not:
>>>> sort tempfile1 > newfile2;
>>>
>>> Even that's too convoluted - why not just
>>> sort -o file file
>>
>> Because that is not equivalent. For example you can't tell from what
>> is presented whether tempfile1 is still needed for something else,
>> after the sort.
>
> The original pipeline was:
>
> cat tempfile1 | sort > newfile2; rm tempfile1
Fine, but you replied on a message with a changed one.
If sort would somehow fail, I assume (some copy of) "file" will remain
available, after a "sort -o file file".
--
Affijn, Ruud
"Gewoon is een tijger."
------------------------------
Date: Fri, 3 Nov 2006 15:58:56 +0100
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: Perl equivalent to unix script
Message-Id: <slrnekmm9g.g7v.hjp-usenet2@yoyo.hjp.at>
On 2006-11-03 12:55, Dr.Ruud <rvtol+news@isolution.nl> wrote:
> If sort would somehow fail, I assume (some copy of) "file" will remain
> available, after a "sort -o file file".
Depends on the implementation. With GNU sort this is not guaranteed.
After file has been completely read and (partially) sorted, it is opened
for writing. If GNU sort fails after that you are left with only a
partial copy. If you have enough space it is safer to invoke
sort file > file.$$ && mv file.$$ file
hp
--
_ | Peter J. Holzer | > Wieso sollte man etwas erfinden was nicht
|_|_) | Sysadmin WSR | > ist?
| | | hjp@hjp.at | Was sonst wäre der Sinn des Erfindens?
__/ | http://www.hjp.at/ | -- P. Einstein u. V. Gringmuth in desd
------------------------------
Date: 3 Nov 2006 08:03:39 -0800
From: "Sylvain SARMEJEANNE" <sylvain.sarmejeanne.ml@gmail.com>
Subject: Scapy in Perl: Scaperl
Message-Id: <1162569819.468725.113150@k70g2000cwa.googlegroups.com>
Hi,
Scaperl is a portable, customizable packet creation and
sending/sniffing tool. It is based on PCAP and libdnet (and their
respective Perl wrappers). It was tested on NetBSD, GNU/Linux and
Windows XP and should theoretically work on some other platforms such
as FreeBSD, OpenBSD, Mac OS X and proprietary Unixes.
The goal is to have a minimal, portable, efficient implementation of
Scapy concepts (written in Python, see Philippe Biondi's page at
http://www.secdev.org/projects/scapy/), with readable, well commented
code and good documentation.
This is the first public release, only a few fields and dissectors have
been implemented.
People interested can have a look at my web page at
http://sylvainsarmejeanne.free.fr/projects/scaperl for more information
and for the documentation.
Sylvain SARMEJEANNE
------------------------------
Date: 03 Nov 2006 15:14:54 GMT
From: xhoster@gmail.com
Subject: Re: Sorting and Writing Effecient Code
Message-Id: <20061103101523.871$YF@newsreader.com>
wahab-mail@gmx.net wrote:
> Thus spoke Tad McClellan (on 2006-11-03 00:21):
>
> >> # file stuff
> >> foreach my $fname (@files) {
> >> open(my $fh, "$dir$fname") or die "$fname: $!";
> >> ...
> >> ...
> >> close $fh;
> >> }
> >>
> >> Don't forget to close your files, otherwise
> >> your program will fail sensational ...
> >
> >
> > How will it fail?
> > Perl closes any open filehandles when it exits anyway.
>
> If you have several thousand file names in @files,
> the O.P.'s Windows OS should bark after the first
> hundred opened - but not closed ...
lexical file handles are automatically closed when they go out of
scope.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
------------------------------
Date: Fri, 03 Nov 2006 16:43:11 +0100
From: Mirco Wahab <peace.is.our.profession@gmx.de>
Subject: Re: Sorting and Writing Effecient Code
Message-Id: <eifob7$ekf$1@mlucom4.urz.uni-halle.de>
Thus spoke xhoster@gmail.com (on 2006-11-03 16:14):
> wahab-mail@gmx.net wrote:
>> Thus spoke Tad McClellan (on 2006-11-03 00:21):
>> > How will it fail?
>> > Perl closes any open filehandles when it exits anyway.
>> If you have several thousand file names in @files,
>> the O.P.'s Windows OS should bark after the first
>> hundred opened - but not closed ...
>
> lexical file handles are automatically closed
> when they go out of scope.
Not bad!
I didn't know that.
Thanks & Regards!
Mirco
------------------------------
Date: Fri, 03 Nov 2006 13:57:25 GMT
From: Peter Scott <Peter@PSDT.com>
Subject: Re: SQLPlus with Perl
Message-Id: <pan.2006.11.03.13.57.24.468054@PSDT.com>
On Thu, 02 Nov 2006 08:06:14 -0800, The alMIGHTY N wrote:
> Hi, thanks for the reply! After all the searching I've done these past
> couple of days, I came to the same conclusion. I'm putting together a
> quick script that uses DBI to do everything, but I'm still holding out
> hope that there's some solution to this (the senior developers are not
> keen on adding a new module to the system especially since this is such a
> small part of the applicatiion).
>
> How would one go about running sqlplus "in backticks"?
That is really a false optimization. Firstly, it takes about 5 minutes to
add DBI to a machine under most circumstances, and most of that is
waiting. Secondly, you wanted the results of the query put in "some kind
of array", which in DBI would be done with
use DBI;
my $db = DBI->connect('dbi:Oracle...
my $rowref = $db->selectall_arrayref(<<'EOSQL');
... query ...
EOSQL
No one can make a program to do the same by parsing sqlplus output easier.
It can't *get* any easier than that.
Now the only fly in the ointment is that you need DBD::Oracle installed,
and in some circumstances that can be difficult to install, not because of
the module itself, but because of needing the right Oracle client files
for it. But if you have them this also is a 5 minute job, so why not try.
--
Peter Scott
http://www.perlmedic.com/
http://www.perldebugged.com/
------------------------------
Date: Fri, 03 Nov 2006 09:59:38 -0600
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: submitting a form with no name attribute with mechanize
Message-Id: <454b675a$0$10298$815e3792@news.qwest.net>
Nospam wrote:
> Is there a way to submit a form with no name attribute with mechanize, when
> the html is:
>
> <INPUT TYPE=submit VALUE="Submit your ad >> ">
> <input type="hidden" name="posting_id" value="">
> <input type="hidden" name="current_live_date" value="">
Not only does that not have a name, it doesn't even have a form element.
Check the documentation for WWW:Mechanize. See the "form_number"
attribute for submit_form or the "form" method. If there are multiple
forms on the page, you'll need to set the number appropriately.
------------------------------
Date: 3 Nov 2006 11:13:15 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: understanding an error
Message-Id: <4r0mibFov98sU1@news.dfncis.de>
Justin C <justin.news@purestblue.com> wrote in comp.lang.perl.misc:
> I was trying to count the number of elements in a hash, I realise that
> the code below is not the way to do it, I've got that bit sorted now,
> what I want to know is how I got the output I did.
>
> Here is the code:
>
> #!/usr/bin/perl
>
> use warnings ;
> use strict ;
>
> my %hash = (
> "mick" => "jagger",
> "brian" => "jones",
> "keith" => "richards",
> "charlie" => "watts",
> "bill" => "wyman",
> "rolling" => "stones"
> ) ;
>
> # my $n_items = scalar ( keys ( %hash ) ) ;
> # print $n_items, "\n" ;
>
> print scalar ( %hash ), "\n" ;
>
> # end of code
>
> The output, when this is run, is:
> 4/8
>
> Where does that output come from?
perldoc perldata, look for the paragraph starting
If you evaluate a hash in scalar context,
Anno
------------------------------
Date: Fri, 03 Nov 2006 12:53:43 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: understanding an error
Message-Id: <2vamk2ppfov1afje9vm67svoooaubphb1g@4ax.com>
On Fri, 03 Nov 2006 10:17:23 -0000, Justin C
<justin.0611@purestblue.com> wrote:
>I was trying to count the number of elements in a hash,
It would be important to know what you mean with "the number of
elements in a hash": the number of keys()? If so just use that. The
number of values? Well, that's the same. But if you mean the number of
*distinct* values, i.e. the cardinality of the image, then you more or
less fall back on the very FAQ about how to find the distinct elements
from a *list*.
>print scalar ( %hash ), "\n" ;
[snip]
>The output, when this is run, is:
>4/8
As somebody put it, "the value of a hash in scalar context is of
interest only to a perl programmer, not to a Perl programmer".
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: Fri, 03 Nov 2006 13:01:36 +0100
From: Mark Clements <mark.clementsREMOVETHIS@wanadoo.fr>
Subject: Re: WWW::Mechanize - simulating complete page download
Message-Id: <454b2f97$0$25938$ba4acef3@news.orange.fr>
odigity@gmail.com wrote:
> Arg!
>
> Some of the URLs I need to benchmark contain instances of resources
> being downloaded as the result of javascript code being executed. One
> of them actually starts out as a small document containing a form and
> some JS that determines the local time zone, inserts the value in a
> hidden form variable, then submits the form. Lunatics.
>
> I don't think there's any combination of Perl modules or clever tricks
> that will yield a 100% correct solution to the problem of behaving the
> way a browser behaves given an initial URL. What I need is a real
> browser. Ideally, a Perl interface to the Firefox engine that will
Win32::IE::Mechanize
Mozilla::Mechanize
Have never used the latter, but the IE one works well.
Mark
------------------------------
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 9927
***************************************