Re: Problem with my code

2007-08-03 Thread Jeff Pang
-Original Message- From: Mihir Kamdar [EMAIL PROTECTED] $hash{$cdr[2],$cdr[3],$cdr[6],$cdr[7]}=$line; #Add some more cdr key fields if u want. There are (maybe) two problems above. 1. when using hash slice,the form is @hash{'key1','key2'...},not $hash{'key1','key2'...} 2. when you

Re: VMWARE PERL API

2007-08-03 Thread vishnu
hi The problem was like i had to read the config file in /etc/vmware/ directory. * if (open CONFIG, '/etc/vmware/config') { my $libdir; my $line; while (defined($line

Re: Problem with my code

2007-08-03 Thread Chas Owens
On 8/3/07, Jeff Pang [EMAIL PROTECTED] wrote: -Original Message- From: Mihir Kamdar [EMAIL PROTECTED] $hash{$cdr[2],$cdr[3],$cdr[6],$cdr[7]}=$line; #Add some more cdr key fields if u want. There are (maybe) two problems above. 1. when using hash slice,the form is

Re: Problem with my code

2007-08-03 Thread Jeff Pang
-Original Message- From: Chas Owens [EMAIL PROTECTED] Sent: Aug 3, 2007 3:21 AM To: Jeff Pang [EMAIL PROTECTED] Cc: beginners@perl.org Subject: Re: Problem with my code On 8/3/07, Jeff Pang [EMAIL PROTECTED] wrote: -Original Message- From: Mihir Kamdar [EMAIL PROTECTED]

Re: abbreviations

2007-08-03 Thread Mr. Shawn H. Corey
Petra Vide Ogrin wrote: $text =~ m/\b\w{4,8}[^IVX]\.\s\l/g but it doesn't work - it just gets the words at the end of each sentence. So this \l at the end of the match is wrong. What should I do to make it work? Try: $text =~ m/\b\w{4,8}[^IVX]\.\s[a-z]/g -- Just my 0.0002 million

Re: Problem with my code

2007-08-03 Thread Chas Owens
On 8/3/07, Mr. Shawn H. Corey [EMAIL PROTECTED] wrote: snip But the expression $hash{@cdr[2,3,6,7]} is the same as $hash{join($,@cdr[2,3,6,7])} You have just replaced one special variable with another and $ is a bad choice since it's default is a space character, which may easily appear in

Re: library (random numbers)

2007-08-03 Thread Mr. Shawn H. Corey
Amichai Teumim wrote: ./script.pl | echo 1234 Or is this nonsensical? Very very new to Perl. This is actually shell: echo 1234 | ./script.pl Try: ./script.pl EOD 1234 5678 90 EOD -- Just my 0.0002 million dollars worth, Shawn For the things we have to learn before we can do them,

Re: library (random numbers)

2007-08-03 Thread Paul Lalli
On Aug 3, 6:03 am, [EMAIL PROTECTED] (Amichai Teumim) wrote: After some friendly input from yitzle I might have moved further with my library. This is my script. script.pl #!/usr/bin/perl Get into the habbit of using use strict; use warnings; in all of your scripts. You will be greatful

library (random numbers)

2007-08-03 Thread Amichai Teumim
After some friendly input from yitzle I might have moved further with my library. This is my script. script.pl #!/usr/bin/perl #require 'lib.pl'; @userArray = STDIN; $sum = sumIt(@userArray); print $sum; And this is my library according to yitzle: sub sumIt(@) { my $total = 0; $total

Re: library (random numbers)

2007-08-03 Thread Chas Owens
On 8/3/07, Amichai Teumim [EMAIL PROTECTED] wrote: snip sub sumIt(@) snip sub avg(@) snip Ack prototypes! They don't do what you think they do. Don't use them until you have read http://library.n0i.net/programming/perl/articles/fm_prototypes and understand it fully. Prototypes are very

Howto strip html from a $calar with HTML::Parser

2007-08-03 Thread Alan C
Hi, I saw the doc for HTML::Parser. I looked at its hstrip program in the eg folder but dunno how to strip a scalar instead of a file. I can strip a file. But I want to strip a scalar. Any help appreciated. As my code is currently, when ran, it prints text to STDOUT and the $source scalar

Re: Problem with my code

2007-08-03 Thread Chas Owens
On 8/3/07, Mr. Shawn H. Corey [EMAIL PROTECTED] wrote: snip Whnever you use a composite key, you have the possibility of a collision. snip Okay, I will concede that, but there is generally a character that is safe (usually the character the line was split on). In this case $hash{join ',',

Re: Howto strip html from a $calar with HTML::Parser

2007-08-03 Thread Mumia W.
On 08/03/2007 03:30 AM, Alan C wrote: [...] I do not need to print to STDOUT Is the print @ line in the sub doing this? [...] Yes. Why not append the text to $string instead of printing the text? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL

Re: Problem with my code

2007-08-03 Thread Xavier Noria
El Aug 3, 2007, a las 1:45 PM, Mr. Shawn H. Corey escribió: But the expression $hash{@cdr[2,3,6,7]} is the same as $hash{join ($,@cdr[2,3,6,7])} You have just replaced one special variable with another and $ is a bad choice since it's default is a space character, which may easily appear

Re: Problem with my code

2007-08-03 Thread Chas Owens
On 8/3/07, Mr. Shawn H. Corey [EMAIL PROTECTED] wrote: Chas Owens wrote: The use of the special variable $; is not why $foo{$a[1],$a[2],$a[3],$a[4]} is a bad choice; it is a bad choice because it is hard to tell if they meant to use @foo{$a[1],$a[2],$a[3],$a[4]} but screwed up the sigil.

abbreviations

2007-08-03 Thread Petra Vide Ogrin
Hi all, I have a text with a lot of abbreviations in it and would like to annotate them. I did it for the shorter ones with $text =~ m/\b\w{0,3}[^IVX]\./g and it works fine. But I would like to get the longer ones as well. The trouble with the long strings ending with a full-stop is that

Re: Problem with my code

2007-08-03 Thread Mr. Shawn H. Corey
Chas Owens wrote: Note that my advice is to use $hash3{@key} Which does not suffer from that problem and that I specifically said you don't want the spaces that using an array slice will add. Whnever you use a composite key, you have the possibility of a collision. #!/usr/bin/perl use

Re: Problem with my code

2007-08-03 Thread Mr. Shawn H. Corey
Chas Owens wrote: On 8/3/07, Jeff Pang [EMAIL PROTECTED] wrote: -Original Message- From: Mihir Kamdar [EMAIL PROTECTED] $hash{$cdr[2],$cdr[3],$cdr[6],$cdr[7]}=$line; #Add some more cdr key fields if u want. There are (maybe) two problems above. 1. when using hash slice,the form is

Sending HTML Email Using EMAIL::MIME::CreateHTML

2007-08-03 Thread Travis Hervey
I am using the Email::MIME:CreateHTML module to send html formatted emails. It all works fine until I try to change the To line to a scalar so that I can mass mail to different individuals. Has anyone used this module in a manner like this before? Thanks, my $email = [EMAIL PROTECTED];

Re: Problem with my code

2007-08-03 Thread Mr. Shawn H. Corey
Chas Owens wrote: The use of the special variable $; is not why $foo{$a[1],$a[2],$a[3],$a[4]} is a bad choice; it is a bad choice because it is hard to tell if they meant to use @foo{$a[1],$a[2],$a[3],$a[4]} but screwed up the sigil. The spaces are only important if you want to recover the

Re: Problem with my code

2007-08-03 Thread Mr. Shawn H. Corey
Chas Owens wrote: Okay, I will concede that, but there is generally a character that is safe (usually the character the line was split on). In this case $hash{join ',', @cdr[2,3,6,7]} = $line; is safe due to the fact that @cdr was created using split /,/, so I would recommend that over a

Re: Sending HTML Email Using EMAIL::MIME::CreateHTML

2007-08-03 Thread daniel bosold
On Fri Aug 3 13:22:11 2007, Travis Hervey wrote: I am using the Email::MIME:CreateHTML module to send html formatted emails. It all works fine until I try to change the To line to a scalar so that I can mass mail to different individuals. Has anyone used this module in a manner like this

Re: Problem with my code

2007-08-03 Thread Chas Owens
On 8/3/07, Mr. Shawn H. Corey [EMAIL PROTECTED] wrote: Chas Owens wrote: Okay, I will concede that, but there is generally a character that is safe (usually the character the line was split on). In this case $hash{join ',', @cdr[2,3,6,7]} = $line; is safe due to the fact that @cdr

Re: VMWARE PERL API

2007-08-03 Thread Chas Owens
On 8/3/07, vishnu [EMAIL PROTECTED] wrote: snip I think this stuff is going a bit complicated.. please give my some links on perl concepts. i have fome pdf files from perk.org.. but they are a bit basic and not deep into such things. please refer dome books that might by of some use to me :)

Re: VMWARE PERL API

2007-08-03 Thread Chas Owens
On 8/3/07, Chas Owens [EMAIL PROTECTED] wrote: On 8/3/07, vishnu [EMAIL PROTECTED] wrote: snip I think this stuff is going a bit complicated.. please give my some links on perl concepts. i have fome pdf files from perk.org.. but they are a bit basic and not deep into such things.

Re: Problem with my code

2007-08-03 Thread [EMAIL PROTECTED]
On Aug 3, 6:54 am, [EMAIL PROTECTED] (Mihir Kamdar) wrote: I appreciate your comments and have tried to make changes as per your suggestions. Plz have a look at the below and comment if any further changes are required. This is turning out to be a good learning for me. Most of the things I

automatically open ports

2007-08-03 Thread horizxon
Im not sure where to post this as Im really looking for the functionality not specifically that it have to be in the perl language. How would I make something that would automatically open the correct ports for a certain machine without my having to be at the machine goto 192.168.1.1 in a browser

Re: automatically open ports

2007-08-03 Thread Ken Foskey
On Fri, 2007-08-03 at 15:49 -0700, [EMAIL PROTECTED] wrote: Im not sure where to post this as Im really looking for the functionality not specifically that it have to be in the perl language. How would I make something that would automatically open the correct ports for a certain machine

Re: automatically open ports

2007-08-03 Thread Jeff Pang
-Original Message- From: [EMAIL PROTECTED] Sent: Aug 4, 2007 6:49 AM To: beginners@perl.org Subject: automatically open ports Im not sure where to post this as Im really looking for the functionality not specifically that it have to be in the perl language. How would I make something

Re: XML to inMemory Hash

2007-08-03 Thread Prabu Ayyappan
Hi All, Thanks for the valuable inputs, I am planning to solve my memory issue by making the XML into Chunks using Xml::Twig and using simplify( ) in XML::Twig to convert that chunks back into the Hash data structure. Is that advicable method to proceed to reduce my Memory size.So that

Re: Howto strip html from a $calar with HTML::Parser

2007-08-03 Thread Alan C
Thanks for the replies. I've added them to my searchable data. My forgetfullness worsens as I get older. I'd totally forgotten that I'd once done this with HTML::Strip And I began reinventing the wheel the other day. Lynx too, forgot about that (Slackware 12.0 right now). Anyways, here's a