Re: split based on n number of occurances of a character

2007-10-26 Thread Jeff Pang
using a regex is may suitable. $ perl -e '$x= a;b;c;d;e;f;g;h;@re=$x=~/(\w+;\w+);{0,1}/g;print @re' a;b c;d e;f g;h On 10/26/07, Mahurshi Akilla [EMAIL PROTECTED] wrote: Is there an easy way (without writing our own proc) to split a string based on number of occurances of a character ? for

Re: Absolute noobie question regarding opening files on Windows platform

2007-10-26 Thread mAyur
On Oct 23, 6:55 pm, [EMAIL PROTECTED] (Paul Lalli) wrote: On Oct 22, 3:27 pm, [EMAIL PROTECTED] (Ayesha) wrote: Hi all I wrote this code to read a file (in the same directory as the script) on Win XP

packing a C structure

2007-10-26 Thread haairam
hi,, iam new to perl..i would like to pack a C structure to send it via socket this is my C structure typedef struct buffer_t { uint32_t a; char b[16]; uint32_t c; uint32_t d; char e[6]; char f[8]; } buffer_t; can u provide a guideline for the format in the Pack command that i

how to print dual key hash..

2007-10-26 Thread newBee
I have the fallowing code segment in my code. I want to print my %termWeightHash to see if i have correct data at the end of the this computation. Since this hash has two keys(I guess way to think that is hash within) I am not sure how to print it.. regular one key has i could print like this...

$SIG return to default

2007-10-26 Thread dolfantimmy
I need to use $SIG to modify the behavior of die in a portion of my code. The module I am calling uses die instead of returning a certain error, that I EXPECT to encounter. So, I can do this $SIG{_ _DIE_ _} = sub { my $message = shift; print STDOUT Script died with this message:\n;

Re: $SIG return to default

2007-10-26 Thread Jeff Pang
use local,like: { # in a code block local $SIG{__DIE__} = sub { }; do something... } when code run out of the block,$SIG{__DIE__} will restore to its default value. On 10/26/07, dolfantimmy [EMAIL PROTECTED] wrote: I need to use $SIG to modify the behavior of die in a portion of

RE: Separating the body of the text in email from its header

2007-10-26 Thread Nagasamudram, Prasanna Kumar
The usually the format of the mail will be HEADER1 HEADER2 HEADER3 .. .. .. HEADERn BODY Please note there will be a blank line b/w the end of the header and the body. So you start from the beginning of the mail and keep ignoring the lines until you find a blank line The rest of it would be

Re: Separating the body of the text in email from its header

2007-10-26 Thread Jeff Pang
On 10/26/07, Praveena Vittal [EMAIL PROTECTED] wrote: Hi, I need a urgent help How can we separate the body of the text in an email from its header? This is not easy to do it by hand,you must be pretty much familiar with RFC822 and 2822. Luckly there's already a module on cpan which

Re: how to print dual key hash..

2007-10-26 Thread Jeff Pang
On 10/26/07, newBee [EMAIL PROTECTED] wrote: I have the fallowing code segment in my code. I want to print my %termWeightHash to see if i have correct data at the end of the this computation. Since this hash has two keys(I guess way to think that is hash within) I am not sure how to print it..

Re: How to keep working after restarting the host

2007-10-26 Thread Jeff Pang
On 10/26/07, Cheellay Zen [EMAIL PROTECTED] wrote: Hello, I need to restart the host several times in the process of my script, and I'd like the script to keep working after restarting, How can I do this? Hi, You may consider to use a local file for record the current process case

Separating the body of the text in email from its header

2007-10-26 Thread Praveena Vittal
Hi, I need a urgent help How can we separate the body of the text in an email from its header? Regards, Praveena -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: Separating the body of the text in email from its header

2007-10-26 Thread Praveena Vittal
Thanks for your suggestion. Nagasamudram, Prasanna Kumar wrote, On 10/26/2007 02:51 PM: The usually the format of the mail will be HEADER1 HEADER2 HEADER3 .. .. .. HEADERn BODY Please note there will be a blank line b/w the end of the header and the body. So you start from the beginning

How to keep working after restarting the host

2007-10-26 Thread Cheellay Zen
Hello, I need to restart the host several times in the process of my script, and I'd like the script to keep working after restarting, How can I do this? Thanks, Cheellay Zen

Re: packing a C structure

2007-10-26 Thread Jeff Pang
On 10/26/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: can u provide a guideline for the format in the Pack command that i need to use... Hi, Consider to read `perldoc -f pack` at first which maybe will help you. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands,

split based on n number of occurances of a character

2007-10-26 Thread Mahurshi Akilla
Is there an easy way (without writing our own proc) to split a string based on number of occurances of a character ? for example: $my_string = a;b;c;d;e;f;g;h @regsplitarray = split (/;/, $my_string) splits based on every 1 occurance of ; what if i want it to do 2 at a time ? e.g.

Re: error in qx

2007-10-26 Thread Jeff Pang
On 10/26/07, Sayed, Irfan (Irfan) [EMAIL PROTECTED] wrote: Hi All, I am executing my $usr=qx(who am i); to get the user id on unix machine but it is giving error. sh: who am i: not found Oops,it's `whoami` not `who am i` unless you have aliased it. -- To unsubscribe, e-mail: [EMAIL

Re: back slash problem

2007-10-26 Thread mAyur
On Oct 4, 5:19 pm, [EMAIL PROTECTED] (Praveena Vittal) wrote: Hi All, I need a way to replace a backslash(ie:\) with \\ in a string. Please help me... eg:ssh\[[\d]*\] from [\d\.]* consider the string Regards, Praveena $srt =~s/\\//g; -- To unsubscribe, e-mail: [EMAIL PROTECTED]

how to print dual key hash..

2007-10-26 Thread newBee
I have the fallowing code segment in my code. I want to print my foreach $document(@documents){ $valueOfTermD = 0; $powerOfTermD = 0; foreach $term(keys %termWeightHash){ if($termWeightHash{$term}{$document}){ $powerOfTermD =

Re: error in qx

2007-10-26 Thread Beginner
On 26 Oct 2007 at 19:14, Jeff Pang wrote: On 10/26/07, Sayed, Irfan (Irfan) [EMAIL PROTECTED] wrote: Hi All, I am executing my $usr=qx(who am i); to get the user id on unix machine but it is giving error. sh: who am i: not found Oops,it's `whoami` not `who am i` unless you have

error in qx

2007-10-26 Thread Sayed, Irfan (Irfan)
Hi All, I am executing my $usr=qx(who am i); to get the user id on unix machine but it is giving error. sh: who am i: not found Please guide how to resolve this Thanks Irfan.

RE: error in qx

2007-10-26 Thread Sayed, Irfan (Irfan)
Thanks for replying to this mail. Now I need to write a regular expression so that I only get username from the output of this command. So I have written like this. my $usr=`who am i`; $usr=~ m{(.+)\s$}; print $usr\n; But still I am not getting only username. Please guide. Regards Irfan.

Re: Parsing Bounced Emails

2007-10-26 Thread Nigel Peck
Matthew Whipple wrote: http://www.epigroove.com/posts/69/review_of_bbounce_stay_away_far_away ... It this an example of a bounce response that you're having problems parsing? No it's just some other people discussing how they've had the same experience as me with bbounce.com, it sounds

Re: error in qx

2007-10-26 Thread Jeff Pang
On 10/26/07, Beginner [EMAIL PROTECTED] wrote: -bash-3.00$ who am i dpaikkos pts/14 Oct 26 12:16 (host.mydomain.com) Work for me on a bash shell as does whoami. No. You're actually executing the `who` command,which just take the `am i` as its arguments. The results are the same: $

Re: Parsing Bounced Emails

2007-10-26 Thread Nigel Peck
Tom Phoenix wrote: Mail::DeliveryStatus::BounceParser... it doesn't work Maybe you need to fix that module so that it works for you, or to use a different module, or even to write parsing code from scratch. If you can't find a more suitable module for your needs, you could try

Re: error in qx

2007-10-26 Thread yitzle
$ who --help Usage: who [OPTION]... [ FILE | ARG1 ARG2 ] ... -monly hostname and user associated with stdin ... If ARG1 ARG2 given, -m presumed: `am i' or `mom likes' are usual. `who am i` is the same as writing `who -m` $ whoami --help .. Same as id -un.

Re: error in qx

2007-10-26 Thread Gunnar Hjalmarsson
Sayed, Irfan (Irfan) wrote: Jeff Pang wrote: You're actually executing the `who` command,which just take the `am i` as its arguments. The results are the same: $ who am i pyh pts/0Oct 26 18:48 (116.21.60.xx) $ who pyh pts/0Oct 26 18:48 (116.21.60.xx) This is `whoami`

Re: Absolute noobie question regarding opening files on Windows platform

2007-10-26 Thread Ron Bergin
On Oct 25, 9:38 pm, [EMAIL PROTECTED] (mAyur) wrote: On Oct 23, 6:55 pm, [EMAIL PROTECTED] (Paul Lalli) wrote: On Oct 22, 3:27 pm, [EMAIL PROTECTED] (Ayesha) wrote: Hi all I wrote this code to read a file (in the same directory as the script) on Win XP

Re: error in qx

2007-10-26 Thread Chas. Owens
On 10/26/07, Jeff Pang [EMAIL PROTECTED] wrote: On 10/26/07, Sayed, Irfan (Irfan) [EMAIL PROTECTED] wrote: Hi All, I am executing my $usr=qx(who am i); to get the user id on unix machine but it is giving error. sh: who am i: not found Oops,it's `whoami` not `who am i` unless you have

Re: error in qx

2007-10-26 Thread Christer Ekholm
Sayed, Irfan (Irfan) [EMAIL PROTECTED] writes: Hi All, I am executing my $usr=qx(who am i); to get the user id on unix machine but it is giving error. sh: who am i: not found Please guide how to resolve this The problem is that you are trying to run the command who am i (with spaces),

Re: Finding time difference from two strings

2007-10-26 Thread Rob Dixon
Wijaya Edward wrote: Hi, Suppose I have this two strings: my $beginning = 'Fri Oct 25 17:37:58 2007'; my $end = 'Fri Oct 26 06:54:09 2007'; How can I compute the time difference between them (in secs)? Is there any CPAN module that does that? I have a large text files which contain two

Finding time difference from two strings

2007-10-26 Thread Wijaya Edward
Hi, Suppose I have this two strings: my $beginning = 'Fri Oct 25 17:37:58 2007'; my $end = 'Fri Oct 26 06:54:09 2007'; How can I compute the time difference between them (in secs)? Is there any CPAN module that does that? I have a large text files which contain two columns (begin + end)

Re: packing a C structure

2007-10-26 Thread Chas. Owens
On 10/26/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: hi,, iam new to perl..i would like to pack a C structure to send it via socket this is my C structure typedef struct buffer_t { uint32_t a; char b[16]; uint32_t c; uint32_t d; char e[6]; char f[8]; } buffer_t;

Re: Finding time difference from two strings

2007-10-26 Thread Rob Dixon
Wijaya Edward wrote: Hi, Suppose I have this two strings: my $beginning = 'Fri Oct 25 17:37:58 2007'; my $end = 'Fri Oct 26 06:54:09 2007'; How can I compute the time difference between them (in secs)? Is there any CPAN module that does that? I have a large text files which contain two

Re: split based on n number of occurances of a character

2007-10-26 Thread Mahurshi Akilla
On Oct 26, 3:51 am, [EMAIL PROTECTED] (Jeff Pang) wrote: using a regex is may suitable. $ perl -e '$x= a;b;c;d;e;f;g;h;@re=$x=~/(\w+;\w+);{0,1}/g;print @re' a;b c;d e;f g;h On 10/26/07, Mahurshi Akilla [EMAIL PROTECTED] wrote: Is there an easy way (without writing our own proc) to split

Re: New to PerlNET

2007-10-26 Thread TonyShirt
Are you sure you want a .Net DLL? Looks to me like you need a COM DLL instead. How do you try to register it? Via regsvr32? If yes then you most definitely need a COM DLL. And need to look at PerlCtrl, not PerlNET. Jenda = [EMAIL PROTECTED] ===http://Jenda.Krynicky.cz= When it

Re: split based on n number of occurances of a character

2007-10-26 Thread yitzle
@re = $x=~/(\w+;\w+);{0,1}/g; Array @re holds the resulting matches (inside the brackets) of the RegEx $x=~/(\w+;\w+);{0,1}/g $x=~/(\w+;\w+);{0,1}/g the /g means don't stop after one match. /(\w+;\w+);{0,1}/ \w is a word This matches one or more word(s) followed by a semicolon, again one or more

Trouble with Perl Standalone Executable

2007-10-26 Thread Yoyoyo Yoyoyoyo
Hi all, I was interested in compiling my Perl code. I came across the following site that shows how to do it: http://www.expertsrt.com/tutorials/Matt/perlPAR.html I followed the instructions (I am using PAR and PAR-Packer version 0.976). It works fine on my Mac, but If I take an executable

Re: Trouble with Perl Standalone Executable

2007-10-26 Thread Chas. Owens
On 10/26/07, Yoyoyo Yoyoyoyo [EMAIL PROTECTED] wrote: Hi all, I was interested in compiling my Perl code. I came across the following site that shows how to do it: http://www.expertsrt.com/tutorials/Matt/perlPAR.html I followed the instructions (I am using PAR and PAR-Packer version

Re: split based on n number of occurances of a character

2007-10-26 Thread Chas. Owens
On 10/26/07, yitzle [EMAIL PROTECTED] wrote: @re = $x=~/(\w+;\w+);{0,1}/g; Array @re holds the resulting matches (inside the brackets) of the RegEx $x=~/(\w+;\w+);{0,1}/g $x=~/(\w+;\w+);{0,1}/g the /g means don't stop after one match. /(\w+;\w+);{0,1}/ \w is a word This matches one or

Re: Trouble with Perl Standalone Executable

2007-10-26 Thread Yoyoyo Yoyoyoyo
Oh, I thought that they might be portable between OSs. My bad. Chas. Owens [EMAIL PROTECTED] wrote: On 10/26/07, Yoyoyo Yoyoyoyo wrote: Hi all, I was interested in compiling my Perl code. I came across the following site that shows how to do it:

Re: Trouble with Perl Standalone Executable

2007-10-26 Thread Chas. Owens
On 10/26/07, Yoyoyo Yoyoyoyo [EMAIL PROTECTED] wrote: Oh, I thought that they might be portable between OSs. My bad. PAR files can be: http://search.cpan.org/~smueller/PAR-0.976/lib/PAR/Tutorial.pod#Cross-platform_Packages But the binaries created by pp can't:

Re: New to PerlNET

2007-10-26 Thread Jenda Krynicky
On 26 Oct 2007 at 17:15, [EMAIL PROTECTED] wrote: Are you sure you want a .Net DLL? Looks to me like you need a COM DLL instead. How do you try to register it? Via regsvr32? If yes then you most definitely need a COM DLL. And need to look at PerlCtrl, not PerlNET. Jenda I thought

Calling C++ function using Perl

2007-10-26 Thread Bilashi Sahu
Hi, I am testing some APIs written in C++. Now I am trying to do automation in Perl. Just wondering is there any way I can call C++ APIs using Perl. Thanks a lot in advance for your reply, Bilashi

Re: Calling C++ function using Perl

2007-10-26 Thread Chas. Owens
On 10/26/07, Bilashi Sahu [EMAIL PROTECTED] wrote: snip Now I am trying to do automation in Perl. Just wondering is there any way I can call C++ APIs using Perl. snip You have two options: Inline::CPP* and XS*. Inline::CPP is probably easier to setup, but XS is more robust. * see

Re: split based on n number of occurances of a character

2007-10-26 Thread Chris Charley
- Original Message - From: Jeff Pang [EMAIL PROTECTED] Newsgroups: perl.beginners To: Mahurshi Akilla [EMAIL PROTECTED] Cc: beginners@perl.org Sent: Friday, October 26, 2007 6:51 AM Subject: Re: split based on n number of occurances of a character On 10/26/07, Mahurshi Akilla [EMAIL

Re: split based on n number of occurances of a character

2007-10-26 Thread Rob Dixon
Mahurshi Akilla wrote: Is there an easy way (without writing our own proc) to split a string based on number of occurances of a character ? for example: $my_string = a;b;c;d;e;f;g;h @regsplitarray = split (/;/, $my_string) splits based on every 1 occurance of ; what if i want it to do 2 at

help on ip addr

2007-10-26 Thread lists user
Hello, I want to do the things below: a) get all binded IPs on a redhat linux os.there are maybe more than one IP,like eth0,eth1,eth0:1 etc. b) for each IP,I need to know if it's a private network address (like 192.168.0.1) or a public network address. for the first problem I can read