[26215] in Perl-Users-Digest
Perl-Users Digest, Issue: 8401 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Sep 9 14:05:27 2005
Date: Fri, 9 Sep 2005 11:05:04 -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 Fri, 9 Sep 2005 Volume: 10 Number: 8401
Today's topics:
converting a hash where the value is a list of lists to <lynn.watts@ugs.com>
Re: converting a hash where the value is a list of list <someone@example.com>
Installing packages <iss025@bangor.ac.uk>
Re: script attack <emschwar@pobox.com>
Re: script attack <no@email.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 9 Sep 2005 08:55:03 -0700
From: "Lynn" <lynn.watts@ugs.com>
Subject: converting a hash where the value is a list of lists to just a list
Message-Id: <4321b6db$1@usenet.ugs.com>
Hi All,
I have a hash where the values are a list of lists. What I would like to do
is
convert this to a hash where the value is just a reference to an array that
contains
the list of lists. Below is my attempt to convert this to what I want, the
problem
is that I am loosing some people in the process!
use strict;
use warnings;
use Data::Dumper;
my %people = (
'hillrich' => [ [5308125], [2053628], [5312468], [5312492] ],
'hsieh' => [ [5312182], [5312613], [5312517] ],
'prakash' => [],
'florencb' => [
[1420688], [1420596], [5312242], [5306884], [5305217], [5248521],
],
'x_shukl' => []
);
my %new_format_people=();
foreach my $person(keys %people) {
foreach my $item (@{ $people{$person} }) {
for ( @$item) {
push @{$new_format_people{$person}},$_;
}
}
}
print Dumper(\%new_format_people);
output is:
$VAR1 = {
'hillrich' => [
5308125,
2053628,
5312468,
5312492
],
'hsieh' => [
5312182,
5312613,
5312517
],
'florencb' => [
1420688,
1420596,
5312242,
5306884,
5305217,
5248521
]
};
I lost prakash and x_shukl in the conversion process. How can I keep these
people
in the new hash I am creating?
Thanks
Lynn
------------------------------
Date: Fri, 09 Sep 2005 17:05:30 GMT
From: "John W. Krahn" <someone@example.com>
Subject: Re: converting a hash where the value is a list of lists to just a list
Message-Id: <uhjUe.234088$HI.33385@edtnps84>
Lynn wrote:
>
> I have a hash where the values are a list of lists. What I would like to do
> is convert this to a hash where the value is just a reference to an array
> that contains the list of lists. Below is my attempt to convert this to what
> I want, the problem is that I am loosing some people in the process!
>
> use strict;
> use warnings;
> use Data::Dumper;
> my %people = (
> 'hillrich' => [ [5308125], [2053628], [5312468], [5312492] ],
> 'hsieh' => [ [5312182], [5312613], [5312517] ],
> 'prakash' => [],
> 'florencb' => [
> [1420688], [1420596], [5312242], [5306884], [5305217], [5248521],
> ],
> 'x_shukl' => []
> );
> my %new_format_people=();
> foreach my $person(keys %people) {
> foreach my $item (@{ $people{$person} }) {
> for ( @$item) {
> push @{$new_format_people{$person}},$_;
> }
> }
> }
>
> print Dumper(\%new_format_people);
$ perl -e'
use Data::Dumper;
my %people = (
hillrich => [ [5308125], [2053628], [5312468], [5312492] ],
hsieh => [ [5312182], [5312613], [5312517] ],
prakash => [],
florencb => [ [1420688], [1420596], [5312242], [5306884], [5305217],
[5248521], ],
x_shukl => [],
);
my %new_format_people = %people;
$_ = [ map ref() ? @$_ : $_, @$_ ] for values %new_format_people;
print Dumper \%new_format_people;
'
$VAR1 = {
'hillrich' => [
5308125,
2053628,
5312468,
5312492
],
'hsieh' => [
5312182,
5312613,
5312517
],
'florencb' => [
1420688,
1420596,
5312242,
5306884,
5305217,
5248521
],
'prakash' => [],
'x_shukl' => []
};
John
--
use Perl;
program
fulfillment
------------------------------
Date: Fri, 09 Sep 2005 16:55:32 +0100
From: "P.R.Brady" <iss025@bangor.ac.uk>
Subject: Installing packages
Message-Id: <4321B074.70007@bangor.ac.uk>
I've installed a few packages onto my XP office system using ppm which
has proved very simple. Internet speed has not been a concern as it's
100 Mbit/s.
I now want to transfer these to my system at home where Internet speeds
are very low. Can I transfer these from my office system via CD or
memory stick? Which files do I need to copy across/what is the procedure?
Regards
Phil
------------------------------
Date: Fri, 09 Sep 2005 11:35:05 -0600
From: Eric Schwartz <emschwar@pobox.com>
Subject: Re: script attack
Message-Id: <eto8xy6ywja.fsf@wilson.emschwar>
Alexandre Jaquet <""alexjaquet\"@[no spam]msn.com"> writes:
> I found an very interesting article at
> http://groups.google.com/group/Software-Quality-Process-Group/browse_thread/thread/f99c70fcc83de076/9b4d0ce0070fa2a4?lnk=st&q=perl+sql+injection&rnum=8&hl=en#9b4d0ce0070fa2a4
>
> and would like to use the regex described
A) You should explain what the regex is for those of us who don't care to
read the referenced article.
B) There are 8 specifically cited regexes in that article, and several
more mentioned inline with the paragraphs. Please specify *which*
one.
C) You need to tell us *why* you want to use the regex you want to
use, what that regex is supposed to accomplish, and ideally why you
think it should accomplish that.
> but how to use it if I have for exemple :
>
> local our $article = $query->param ('search_name');
Okay, whoah, stop right there. I think, if prompted by sufficient
quantities of tequila, I could come up with a justification for
declaring a variable with 'local' AND 'our', but I'd have to work very
hard to do so, and even then I doubt I'd believe myself. If you don't
have a very good reason for doing that, I'd stick with 'our', or
preferably 'my'.
> if ($article =~ /((\%3D)|(=))[^\n]*((\%27)|(\')|(\-\-)|(\%3B)|(;))/i) {
> $article = '*';
> }
> doesn't work
"doesn't work" is completely useless when describing a problem. You
need to create a short program that:
* Defines $article so that we can see, at a glance, what its contents
are.
* Explains what the regex is supposed to do
* Shows what the regex actually does, and most importantly:
* How that differs from what you expect.
We are not mind-readers. We don't know, unless you tell us, what your
data looks like.
> any help thanks
CLPM helps those who help us help them. (are you confused yet? :)
-=Eric
------------------------------
Date: Fri, 09 Sep 2005 18:55:57 +0100
From: Brian Wakem <no@email.com>
Subject: Re: script attack
Message-Id: <3oe0ldF5bf9bU1@individual.net>
Eric Schwartz wrote:
>> local our $article = $query->param ('search_name');
>
> Okay, whoah, stop right there. I think, if prompted by sufficient
> quantities of tequila, I could come up with a justification for
> declaring a variable with 'local' AND 'our', but I'd have to work very
> hard to do so, and even then I doubt I'd believe myself. If you don't
> have a very good reason for doing that, I'd stick with 'our', or
> preferably 'my'.
'local our' is common use in mod_perl.
http://perl.apache.org/docs/1.0/guide/porting.html#The_First_Mystery
--
Brian Wakem
Email: http://homepage.ntlworld.com/b.wakem/myemail.png
------------------------------
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 8401
***************************************