[30413] in Perl-Users-Digest
Perl-Users Digest, Issue: 1656 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jun 18 16:09:49 2008
Date: Wed, 18 Jun 2008 13:09:12 -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 Wed, 18 Jun 2008 Volume: 11 Number: 1656
Today's topics:
Re: [regex] grep for chars in any order <glennj@ncf.ca>
Re: [regex] grep for chars in any order <glennj@ncf.ca>
DRaw a blank on combinging two arrays <bill@ts1000.us>
Re: extract all hotmail email addresses in a file and s <cartercc@gmail.com>
Re: extract all hotmail email addresses in a file and s <cartercc@gmail.com>
Re: extract all hotmail email addresses in a file and s (Walter Roberson)
extract all hotmail email addresses in a file and store <dchou4u@gmail.com>
Re: extract all hotmail email addresses in a file and s <szrRE@szromanMO.comVE>
Re: grep for chars in any order <simon.chao@fmr.com>
Re: grep for chars in any order <smallpond@juno.com>
Re: Last "real" modification date of file <glennj@ncf.ca>
Re: Last "real" modification date of file <tony_curtis32@yahoo.com>
Re: Last "real" modification date of file <bart@nijlen.com>
Re: Learning Perl <uri@stemsystems.com>
Re: Learning Perl <sbour@niaid.nih.gov>
Re: Perl Script <cartercc@gmail.com>
Re: Perl Script <szrRE@szromanMO.comVE>
Re: Perl XML::Simple Accessing complex XML <jimsgibson@gmail.com>
Re: Search.bat from the command line <brian.helterline@hp.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 18 Jun 2008 16:04:23 GMT
From: Glenn Jackman <glennj@ncf.ca>
Subject: Re: [regex] grep for chars in any order
Message-Id: <slrng5icg8.43k.glennj@smeagol.ncf.ca>
At 2008-06-18 09:01AM, "Ben Bullock" wrote:
> Great! That is better than the solution I posted. But I have an
> improvement:
>
> /(?=.*a)(?=.*b)(?=.*c)/
Nice. I wonder (without bothering to benchmark it) if anchoring the
expression would be an optimization:
/^(?=.*a)(?=.*b)(?=.*c)/
--
Glenn Jackman
Write a wise saying and your name will live forever. -- Anonymous
------------------------------
Date: 18 Jun 2008 16:23:15 GMT
From: Glenn Jackman <glennj@ncf.ca>
Subject: Re: [regex] grep for chars in any order
Message-Id: <slrng5idjk.43k.glennj@smeagol.ncf.ca>
At 2008-06-18 03:06AM, "viki" wrote:
> How can I build regex that matches all characters of the string $STR
> in any order with .* added between any two characters: ?
> And without generating all N! transpositions (where N is length of
> $STR) ?
> Example.
> For $STR "abc", I want to match equivalent to:
> /(a.*b.*c)|(a.*c.*b)|(b.*a.*c)|(b.*c.*a)|(c.*a.*b)|(c.*b.*a)/
>
> Generating all transpositions is not feasible for larger legths of
> $STR.
> /[abc].*[abc].*[abc]/ is easy and fast but gives false positives.
> What is good solution ?
If you're not stuck on creating one regular expression:
sub has_all_chars {
my ($string, $chars) = @_;
my $matched = 1;
foreach my $char (split //, $chars) {
if (index($string, $char) == -1) {
$matched = 0;
last;
}
}
matched;
}
has_all_chars("foobar","rb"); # ==> 1
has_all_chars("foobar","abc"); # ==> 0
--
Glenn Jackman
Write a wise saying and your name will live forever. -- Anonymous
------------------------------
Date: Wed, 18 Jun 2008 12:16:58 -0700 (PDT)
From: Bill H <bill@ts1000.us>
Subject: DRaw a blank on combinging two arrays
Message-Id: <0189f417-6f22-452c-b7b9-6f7a9f2b0a63@26g2000hsk.googlegroups.com>
Earlier I was trying to combing 2 arrays and totally drew a blank on
how to do it. I though it would be join but didn't seem to work. Can
someone tell me what to look up in perldoc for it?
I thought I could used something like @c = join(@a,@b); but just ended
up with one long string.
Bill H
------------------------------
Date: Wed, 18 Jun 2008 13:01:49 -0700 (PDT)
From: cartercc <cartercc@gmail.com>
Subject: Re: extract all hotmail email addresses in a file and store in separate file
Message-Id: <69664adf-4fa0-44ae-83c3-65d3669e5a04@l64g2000hse.googlegroups.com>
On Jun 18, 3:33 pm, Dennis <dcho...@gmail.com> wrote:
> Hi, I have a text file that contents a list of email addresses like
> this:
>
> "f...@yahoo.com"
> "t...@hotmail.com"
> "je...@gmail.com"
> "to...@apple.com"
>
> I like to
>
> 1. Strip out the " characters and just leave the email addresses on
> each line.
> 2. extract out the hotmail addresses and store it into another file.
> The hotmail addresses in the original file would be deleted.
>
> Thanks for any help
open INFILE, "<all_emails.txt";
open HOTMAIL, ">hotmail_only.txt";
open NOTHOTMAIL, ">not_hotmail.txt";
while(<INFILE>)
{
$_ =~ s/"//g;
print HOTMAIL if $_ =~ /hotmail/i;
print NOTHOTMAIL if $_ != /hotmail/i;
}
close INFILE;
close HOTMAIL;
close NOTHOTMAIL;
------------------------------
Date: Wed, 18 Jun 2008 13:02:53 -0700 (PDT)
From: cartercc <cartercc@gmail.com>
Subject: Re: extract all hotmail email addresses in a file and store in separate file
Message-Id: <7b8b9cbe-a020-40be-9fe4-a58652edd859@d77g2000hsb.googlegroups.com>
On Jun 18, 3:33 pm, Dennis <dcho...@gmail.com> wrote:
> Hi, I have a text file that contents a list of email addresses like
> this:
>
> "f...@yahoo.com"
> "t...@hotmail.com"
> "je...@gmail.com"
> "to...@apple.com"
>
> I like to
>
> 1. Strip out the " characters and just leave the email addresses on
> each line.
> 2. extract out the hotmail addresses and store it into another file.
> The hotmail addresses in the original file would be deleted.
>
> Thanks for any help
open INFILE, "<all_emails.txt";
open HOTMAIL, ">hotmail_only.txt";
open NOTHOTMAIL, ">not_hotmail.txt";
while(<INFILE>)
{
$_ =~ s/"//g;
print HOTMAIL if $_ =~ /hotmail/i;
print NOTHOTMAIL if $_ != /hotmail/i;
}
close INFILE;
close HOTMAIL;
close NOTHOTMAIL;
------------------------------
Date: Wed, 18 Jun 2008 20:06:09 +0000 (UTC)
From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)
Subject: Re: extract all hotmail email addresses in a file and store in separate file
Message-Id: <g3bprh$ev4$1@canopus.cc.umanitoba.ca>
In article <69664adf-4fa0-44ae-83c3-65d3669e5a04@l64g2000hse.googlegroups.com>,
cartercc <cartercc@gmail.com> wrote:
>On Jun 18, 3:33 pm, Dennis <dcho...@gmail.com> wrote:
>> Hi, I have a text file that contents a list of email addresses like
>> this:
>
>> "f...@yahoo.com"
>> "t...@hotmail.com"
>> "je...@gmail.com"
>> "to...@apple.com"
>> I like to
>> 1. Strip out the " characters and just leave the email addresses on
>> each line.
>> 2. extract out the hotmail addresses and store it into another file.
>> The hotmail addresses in the original file would be deleted.
>open INFILE, "<all_emails.txt";
>open HOTMAIL, ">hotmail_only.txt";
>open NOTHOTMAIL, ">not_hotmail.txt";
>while(<INFILE>)
>{
> $_ =~ s/"//g;
> print HOTMAIL if $_ =~ /hotmail/i;
> print NOTHOTMAIL if $_ != /hotmail/i;
>}
>close INFILE;
>close HOTMAIL;
>close NOTHOTMAIL;
In your program, the match of /hotmail/ could occur on the left-hand size
of the @ . For example,
"my_other_account_is_hotmail@msn.com"
Your code would mistakenly file this in the wrong place.
Your code also does not satisfy the requirement that,
"The hotmail addresses in the original file would be deleted"
which requires that the original file be altered.
--
"For men are prone to go it blind along the calf-paths of the
mind To do what other men have done. They follow in the beaten
track, and out and in, and forth and back, and still their
devious course pursue, to keep the path that others do." -- Sam Walter Foss
------------------------------
Date: Wed, 18 Jun 2008 12:33:45 -0700 (PDT)
From: Dennis <dchou4u@gmail.com>
Subject: extract all hotmail email addresses in a file and store in separate file
Message-Id: <e4359263-995d-4b1a-8865-9a97eceb7dc2@m36g2000hse.googlegroups.com>
Hi, I have a text file that contents a list of email addresses like
this:
"foo@yahoo.com"
"tom@hotmail.com"
"jerry@gmail.com"
"tommy@apple.com"
I like to
1. Strip out the " characters and just leave the email addresses on
each line.
2. extract out the hotmail addresses and store it into another file.
The hotmail addresses in the original file would be deleted.
Thanks for any help
------------------------------
Date: Wed, 18 Jun 2008 13:05:23 -0700
From: "szr" <szrRE@szromanMO.comVE>
Subject: Re: extract all hotmail email addresses in a file and store in separate file
Message-Id: <g3bpqd01mf6@news4.newsguy.com>
Dennis wrote:
> Hi, I have a text file that contents a list of email addresses like
> this:
>
> "foo@yahoo.com"
> "tom@hotmail.com"
> "jerry@gmail.com"
> "tommy@apple.com"
>
> I like to
>
> 1. Strip out the " characters and just leave the email addresses on
> each line.
> 2. extract out the hotmail addresses and store it into another file.
> The hotmail addresses in the original file would be deleted.
>
> Thanks for any help
To get you started, assuming there are no escaped quotes in between:
while (m!"([^"]+?)"!g) {
if ($1 =~ m!\@hotmail\.com!) {
... do something with $1
}
else { ... }
}
Or if you are using an array:
foreach my $email (map { s!"([^"]+?)"!$1!g; $_; } @email_list) {
if ($email =~ m!\@hotmail\.com!) {
...
}
else { ... }
}
(Note, untested, but should give a starting point.)
--
szr
------------------------------
Date: Wed, 18 Jun 2008 09:51:18 -0700 (PDT)
From: nolo contendere <simon.chao@fmr.com>
Subject: Re: grep for chars in any order
Message-Id: <03732b73-b53e-455d-9563-39da6a64995a@c65g2000hsa.googlegroups.com>
On Jun 18, 12:23=A0pm, Glenn Jackman <gle...@ncf.ca> wrote:
> At 2008-06-18 03:06AM, "viki" wrote:
>
> > =A0How can I build regex that matches all characters of the string $STR
> > =A0in any order with =A0.* added between any two characters: ?
> > =A0And without generating all N! transpositions (where N is length of
> > =A0$STR) ?
> > =A0Example.
> > =A0For $STR "abc", I want to match equivalent to:
> > =A0/(a.*b.*c)|(a.*c.*b)|(b.*a.*c)|(b.*c.*a)|(c.*a.*b)|(c.*b.*a)/
>
> > =A0Generating all transpositions is not feasible for larger legths of
> > =A0$STR.
> > =A0/[abc].*[abc].*[abc]/ is easy and fast but gives false positives.
> > =A0What is good solution ?
>
> If you're not stuck on creating one regular expression:
>
> =A0 =A0 sub has_all_chars {
> =A0 =A0 =A0 =A0 my ($string, $chars) =3D @_;
> =A0 =A0 =A0 =A0 my $matched =3D 1;
> =A0 =A0 =A0 =A0 foreach my $char (split //, $chars) {
> =A0 =A0 =A0 =A0 =A0 =A0 if (index($string, $char) =3D=3D -1) {
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 $matched =3D 0;
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 last;
> =A0 =A0 =A0 =A0 =A0 =A0 }
> =A0 =A0 =A0 =A0 }
> =A0 =A0 =A0 =A0 matched;
what is this? ^^^
> =A0 =A0 }
> =A0 =A0 has_all_chars("foobar","rb"); # =3D=3D> 1
> =A0 =A0 has_all_chars("foobar","abc"); # =3D=3D> 0
>
This is pretty much what Paul suggested--this amounts to about the
same thing as List::MoreUtils's all() function.
sub all (&@) {
my $f =3D shift;
return if ! @_;
for (@_) {
return 0 if ! $f->();
}
return 1;
}
------------------------------
Date: Wed, 18 Jun 2008 09:59:28 -0700 (PDT)
From: smallpond <smallpond@juno.com>
Subject: Re: grep for chars in any order
Message-Id: <9ba1a6a4-918b-4875-a4a5-6955ac34220c@m44g2000hsc.googlegroups.com>
On Jun 18, 12:23 pm, Glenn Jackman <gle...@ncf.ca> wrote:
> At 2008-06-18 03:06AM, "viki" wrote:
>
> > How can I build regex that matches all characters of the string $STR
> > in any order with .* added between any two characters: ?
> > And without generating all N! transpositions (where N is length of
> > $STR) ?
> > Example.
> > For $STR "abc", I want to match equivalent to:
> > /(a.*b.*c)|(a.*c.*b)|(b.*a.*c)|(b.*c.*a)|(c.*a.*b)|(c.*b.*a)/
>
> > Generating all transpositions is not feasible for larger legths of
> > $STR.
> > /[abc].*[abc].*[abc]/ is easy and fast but gives false positives.
> > What is good solution ?
>
> If you're not stuck on creating one regular expression:
>
> sub has_all_chars {
> my ($string, $chars) = @_;
> my $matched = 1;
> foreach my $char (split //, $chars) {
> if (index($string, $char) == -1) {
> $matched = 0;
> last;
> }
> }
> matched;
> }
> has_all_chars("foobar","rb"); # ==> 1
> has_all_chars("foobar","abc"); # ==> 0
>
> --
> Glenn Jackman
> Write a wise saying and your name will live forever. -- Anonymous
This is a really clever solution. The only thing I would
do differently is to use chop instead of split. Why create
a list unless you need the list?
while (my $char = chop $chars) {
--S
------------------------------
Date: 18 Jun 2008 16:26:36 GMT
From: Glenn Jackman <glennj@ncf.ca>
Subject: Re: Last "real" modification date of file
Message-Id: <slrng5idpt.43k.glennj@smeagol.ncf.ca>
At 2008-06-18 10:03AM, "Bart Van der Donck" wrote:
> Hello,
>
> I am on FreeBSD.
>
> my @stat = stat "file.txt";
> print "Last modified: ";
> print time()-$stat[9]." seconds ago";
>
> Is there a way to find out when file.txt was last changed ?
> I'm facing a situation when a file could legally be (re-)written with
> the same content. Don't ask me how I got there :-)
You'd need to have a CRC or cksum value for the "old" and "new" file to
check for changed content if the timestamp has changed.
--
Glenn Jackman
Write a wise saying and your name will live forever. -- Anonymous
------------------------------
Date: Wed, 18 Jun 2008 12:36:32 -0400
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: Last "real" modification date of file
Message-Id: <g3bdig$ogs$1@knot.queensu.ca>
Bart Van der Donck wrote:
> Hello,
>
> I am on FreeBSD.
>
> my @stat = stat "file.txt";
> print "Last modified: ";
> print time()-$stat[9]." seconds ago";
>
> Is there a way to find out when file.txt was last changed ?
> I'm facing a situation when a file could legally be (re-)written with
> the same content. Don't ask me how I got there :-)
Ah, you actually want to see if the *contents* of the file have changed.
Completely different thing (the file is a container for its content;
stat() just reports on the container). You'll need some kind of
meta-information, e.g. md5 hash, to match against.
hth
t
------------------------------
Date: Wed, 18 Jun 2008 11:01:28 -0700 (PDT)
From: Bart Van der Donck <bart@nijlen.com>
Subject: Re: Last "real" modification date of file
Message-Id: <71a0dc0e-9ad3-466b-b1af-3fe1764bf002@a1g2000hsb.googlegroups.com>
Glenn Jackman wrote:
> At 2008-06-18 10:03AM, "Bart Van der Donck" wrote:
>
>> =A0Hello,
>
>> =A0I am on FreeBSD.
>
>> =A0 =A0my @stat =3D stat "file.txt";
>> =A0 =A0print "Last modified: ";
>> =A0 =A0print time()-$stat[9]." seconds ago";
>
>> =A0Is there a way to find out when file.txt was last changed ?
>> =A0I'm facing a situation when a file could legally be (re-)written with
>> =A0the same content. Don't ask me how I got there :-)
>
> You'd need to have a CRC or cksum value for the "old" and "new" file to
> check for changed content if the timestamp has changed.
Yes, it seems like there is no other choice than influencing the write
process itself. Backup file, write new content, compare two versions,
store some isModified-flag, delete backup-file.
Thanks to all for your insights.
--
Bart
------------------------------
Date: Wed, 18 Jun 2008 16:02:22 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Learning Perl
Message-Id: <x78wx268a9.fsf@mail.sysarch.com>
>>>>> "GCE" == Gordon Corbin Etly <g....c.e@gmail.com> writes:
GCE> Uri Guttman wrote:
>>>>>>> "GCE" == Gordon Corbin Etly <g....c.e@gmail.com> writes:
>> see you don't get it. it isn't broken behavior but behavior that
>> shouldn't have been there to begin with. like my $x = 1 if 0 stuff
>> which does something that was bad but not deprecated until recently.
GCE> I do get it. Maybe tell nose thumbing would allow us to understand each
GCE> other better.
huh?? and you don't get it. otherwise you wouldn't have been defending
the undefensible for so long. and i don't get that you even acknowledge
you were wrong about it. you recently still asked why it isn't useful
for defined to work on aggregates. that doesn't sound like getting it.
>> and it doesn't almost work that way. and you don't get how allocation
>> works or the difference between a scalar value and an aggregate of
>> them. just let this go as you don't want to learn those things and you
>> are hanging on your little island hoping to be rescured. p5p ain't
>> coming to rescue you. defined on aggregates was never meant to be used
>> and now it will go away like it should.
GCE> Stop assuming I don't get things or that I don't want to learn, as that
GCE> couldn't be further from the truth.
nah, it is very close to the truth. true learners would have shut up
long ago and listened to me or accepted the docs. this is not a complex
issue and you have trolled on it for a long time. defined is meant to
test a scalar value for undef. that is ever worked on aggregates was a
mistake that is being corrected. pretty simple stuff. just post that you
accept that and that you were wrong. this is the path of learning. if
you truly claim you are learning you would do this. but you won't. i
would bet many quatloos on this.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.sysarch.com --
----- Perl Code Review , Architecture, Development, Training, Support ------
--------- Free Perl Training --- http://perlhunter.com/college.html ---------
--------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------
------------------------------
Date: Wed, 18 Jun 2008 12:55:31 -0700
From: "Stephan Bour" <sbour@niaid.nih.gov>
Subject: Re: Learning Perl
Message-Id: <UKd6k.5853$N87.1954@nlpi068.nbdc.sbc.com>
Marc Bissonnette wrote:
} "Stephan Bour" <sbour@niaid.nih.gov> fell face-first on the keyboard.
} This was the result: news:qt86k.5824$N87.2991@nlpi068.nbdc.sbc.com:
}
} > Marc Bissonnette wrote:
} > } Jürgen Exner <jurgenex@hotmail.com> fell face-first on the
} > keyboard. } This was the result:
} > news:4t6h54pbtbp14hsm3lp2qe6djk9qufgvc5@4ax.com: }
} > } > "Stephan Bour" <sbour@niaid.nih.gov> wrote:
} > } > > [about filtering]
} > } > > surprised some people change their email addresses to avoid it.
} > }
} > } > However if someone deliberately changes his FROM header with the
} > } > expressed purpose(!) of avoiding not being heard, then that is
} > } > simply stalking and in many jurisdictions a criminal act.
} > }
} > } I have to agree strongly with this point: While one may have the
} > } "right" to change one's From: header ("right" as in, it's your app,
} > } your information, your computer), it is simply childish attention
} > } getting [1] to change your From: header for the sole purpose of
} > } getting around filters.
} >
} > It may be childish, agreed, but another side may be that no one is
} > bound to adhering to your filters. Some of you seem to over look this
} > little tidbit all too easily.
} >
} > } If someone has decided they don't want to
} > } read - and therefore respond - to your content, who are you [2] to
} > } force them to see your content ?
} >
} > That's where you are really wrong; no one is forced to do _anything_,
} > as you do not have to read _any_ post. Everything you do is by your
} > own choice. If I were to tie you to your chair and tape your eye lids
} > open and shove a laptop with the content opened into your face, that
} > would be another story, but it's most decidedly not the cases here.
}
} I disagree: Personally, I use XNews as my newsreader. I have three
} people in my killfile that are, IMO, prolific nonsense posters. When
} they are killfiled, my articles list is short and concise - I can see
} the ebb and flow of any discussion and choose to read it or not - I
} don't see the ko0k's content *OR* headers, because they are filtered
} out.
That's fine. I agree.
> When they morph, I am indeed forced to see their article headers,
> meaning the three newsgroups they appear in are indeed far more
> cluttered and makes a quick glance at a conversation's ebb and flow
> more difficult.
I agree that is unfortunate, but filtering just a client side user tool,
nothing more, nothing less. There is no guarentee it will always work, and
thus too much faith should not be invested in it. It's a tool. Do you get
upset when your egrep pattern misses something?
> Perhaps *you* don't look at Usenet this way, or skimming articles,
> but I and a great many others do. I know for a fact that a great many
> people agree with this definition of being "forced" to see the
> content.
To me, forced means I have no other alternative but to read the content of
the post. Either you see their name in the topic list, or, when looking at
someone else's reply, usually you have the "foo wrote:" line before the
content. Point being, you always have the choice whether or not to read it.
It's called will power. ;->
} > } [1] I'll admit to doing this myself about three times in fifteen
} > } years - Twice when the heat of an online argument got the better of
} > } me and once to respond to a nutjob who supposedly had me killfiled,
} > } but used Google Groups to reply to my posts when others were
} > } agreeing with them -
} >
} > So it seems here, you are almost vindicating the people who do change
} > their FROM header. You don't do it often, but you did do it to get
} > around someone's killfile.
} >
} > } In all three cases, still childish and plain dumb. Other
} > } than that, my dragnet@ address has remained the same for ten years
} > }or so, with only one change to add \_ and _/ around the @ to mildly
} > } mess up harvesters.
} >
} > And in doing such changes you bypass any filters that have you. And
} > again you've proved that anyone has the right to change such
} > information, childish or not.
}
} Sigh. With all due respect, I believe you are being a pedant
} intentionally. Surely, you don't need actual examples of things where
} one has the "right" to do something, but common sense or courtesy
} curtails it, yes ? Scratch that - I get the feeling you want to take
} the pedantic route, so let's see if I can think of an appropriate
} example.
I don't believe that's what I said; where did I ask for an example?
} Ah! Here's one: My neighbour right now is having his septic tank and
} weeping bed replaced. Given the access to his backyard is quite narrow
} due to two buildings, two massive trees and three sheds, I've told
} their crew they can use my lane and remove the fence between our two
} yards to move their machinery in to do the digging, as well as the
} crane in my laneway to lower the new septic tank.
}
} I have the *RIGHT* to say "Stay off my property". It's *my* property
} - I don't *have* to let heavy equipment over my lawn, remove a fence
} and damage the soil. There wouldn't be a bloody thing my neighbour
} could do about it, either - Without access via my property, they'd
} have to bring in a skidsteer and a small Kubota excavator, rather
} than the one Case backhoe, which would extend the job by a week and
} increase the labour and cost by a factor of five.
This analogy might work if someone were to actually break into your
computer. I don't see how changing one's FROM header can equate to
trespassing; it's more akin to parking your car in way so you don't have to
see the over flowing trash cans of the neighour across the street who have
nine children, and then that neighour comes out and moves the cans over to
the left and once again in sight. Nothing illegal, though possibly rude, but
not necessarily intended as such. It's their can and if they want to move it
they are free to do so.
} But by your logic, it would be perfectly fine to excersise my *right*
} to deny access to my property - Legally, I'm totally covered. Morally,
} however, it's a crappy thing to do.
But a news group is not your personal property. It's akin to public
property. Would you go onto a street corner and tell someone they cannot
place a garbage can because you or your group don't like it there? No. You
would more likely talk to the owner of the can and ask them to move it, but
they are not obligated to agree.
} Somehow, I think that if you were a Canadian, you'd be a die-hard NDP
} voter.
Actually I vote for what I believe is right. I don't vote by any single
party. I take pride in being a free thinking individual, as I'm sure you are
too. :->
Stephan.
------------------------------
Date: Wed, 18 Jun 2008 08:28:49 -0700 (PDT)
From: cartercc <cartercc@gmail.com>
Subject: Re: Perl Script
Message-Id: <fbe06a66-e801-4f5f-bc0a-b8ed9287b391@34g2000hsf.googlegroups.com>
On Jun 18, 10:47 am, Andrew DeFaria <And...@DeFaria.com> wrote:
> That depends on what kind of encryption you use...
This particular database is Postgres. It uses a one way hash. We also
receive social security numbers, which we are required to read into
the database but not required to read out, so we hash these.
Key management is one headache that I don't have. ;-)
CC
------------------------------
Date: Wed, 18 Jun 2008 11:16:24 -0700
From: "szr" <szrRE@szromanMO.comVE>
Subject: Re: Perl Script
Message-Id: <g3bjdo01gtj@news4.newsguy.com>
cartercc wrote:
> On Jun 17, 5:44 am, "Dr.Ruud" <rvtol+n...@isolution.nl> wrote:
>> You have plain passwords in the database?
>
> I do as well for a couple of apps. The reason: a management decision
> that when the user forgets his or her password, an event that occurs
> often, we are to give the user his old password instead of forcing him
> to generate a new password. If we encrypted the passwords in the
> database, we couldn't do this.
It is still infinitely more secure to store passwords in an encrypted
form and reset lost passwords.
--
szr
------------------------------
Date: Wed, 18 Jun 2008 12:33:11 -0700
From: Jim Gibson <jimsgibson@gmail.com>
Subject: Re: Perl XML::Simple Accessing complex XML
Message-Id: <180620081233118849%jimsgibson@gmail.com>
In article
<384b28cf-598d-4911-9612-8ec9e2013c3a@m44g2000hsc.googlegroups.com>,
zzapper <zzapper@gmail.com> wrote:
> On Jun 18, 1:39 pm, "John" <john1...@yahoo.com> wrote:
> > "zzapper" <zzap...@gmail.com> wrote in message
> >
> > news:d4825f41-4e5b-4cbd-b8ee-2288c0cb0cc5@r66g2000hsg.googlegroups.com...
> >
> >
> >
> > > Hi
> > > <companyname count="1">
> > > <property id="55467" md="2008-03-20" mc="GBP" mp="173000" >
> > > <psumm><![CDATA[This 3 bedroom, ]]></psumm>
> > > <a1>1 Bucket Way</a1>
> > > <at>Stafford</at>
> > > <ac>Staffordshire</ac>
> > > <actry></actry>
> > > <images>
> > > <image id="543">Property Image</image>
> > > <image id="545">Property Image</image>
> > > </images>
> > > </property>
> > > </companyname>
> >
> > > I am trying to read the above (simplified) with XML::Simple with or
> > > without ForceArray=1.
> >
> > > I can output everything EXCEPT I cannot find the Perl data syntax to
> > > access anything in <images> eg 543 or
> > > the text "Property Image"
> >
> > > $data = $xml->XMLin("prop.xml", forcearray => 1);
> > > $ac=$data->{property}->{554674}->{ac}[0];
> >
> > > Desperate!!
> > > zzapper
> >
> > Hi
> >
> > With ForceArray turned on.
> >
> > my $temp=$data->{property}->[0]->{images}->[0]->{image}->[0]{id}; # id of
> > first image
> > $temp=$data->{property}->[0]->{images}->[0]->{image}->[1]{id}; # id of
> > second image
> > $temp=$data->{property}->[0]->{images}->[0]->{image}->[0]{content}; #
> > Property Image of first image
> > $temp=$data->{property}->[0]->{images}->[0]->{image}->[1]{content}; #
> > Property Image of second image
> >
> > Regards
> > John
>
> Hi John
> Unfortunately this didn't work for me, the output was blank.
> zzapper
Try:
$data->{property}->{'55467'}->{images}->[0]->{image}->{'545'}->{content}
To figure these things out, use the Data::Dumper module to reveal the
structure of the data returned by XMLin:
print Dumper(\$data);
--
Jim Gibson
------------------------------
Date: Wed, 18 Jun 2008 13:05:39 -0700
From: Brian Helterlilne <brian.helterline@hp.com>
Subject: Re: Search.bat from the command line
Message-Id: <g3bpqj$890$1@usenet01.boi.hp.com>
bdy120602@gmail.com wrote:
> On Jun 17, 5:53 pm, Brian Helterlilne <brian.helterl...@hp.com> wrote:
>> bdy120...@gmail.com wrote:
>>> I'm doing a search from the DOS prompt using the Perl search function
>>> and I would like to search for a special character ($), but the Perl
>>> command doesn't seem to be able to find it. I surround the dollar sign
>>> in quotation marks, and it listed all the files in the directory,
>>> which led me to believe that it couldn't initiate the search properly
>>> because not all the documents contain the $. If I use search from the
>>> Perl command line, meaning after I type "Perl" at the commadn prompt,
>>> I receive
>>> search/"$"
>>> Final $ should be \$ or $name at - line 1, within string
>>> syntax error at - line 1, near "/"$""
>> perl doesn't have a search function. I think you mean you have a perl
>> program called search.pl that searches files.
>>
>> Since you haven't shown us the code, it is hard to tell what the problem
>> is, but an educated guess is that your program is using regular
>> expressions to locate the search string. the '$' character is special
>> within a regular expression. Depending on what you want, you can either
>> escape it within the string \$ or modify the program to not treat any
>> characters as special within the RE (e.g. \Q$string)
>>
>>
>>
>>> Also, I'm searching RTF files. which have HTML coding behind them. Is
>>> there anyway to have Perl search just the text and not the code?
>> you would need to parse the file using one of the many HTML parsing modules.
>>
>>
>>
>>> Thanks.
>> --
>> -brian
>
> Oh, OK. Yes, I want to treat the "$" as a string literal, and the
> backslash allowed me to do that. Would you provide me with the options
> that are available when using search? Yes, I forgot to mention that
> that's the name of the program. Search is a batch file found in /Perl/
> bin, but I can't find instruction for it with perldoc.
I'd start with search -help. If you look at the code, all the
documentation is within the file.
------------------------------
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 V11 Issue 1656
***************************************