Re: Module to parse CSV string

2006-07-19 Thread Todd W
"Chap Harrison" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi, > > I'm looking for a module or a perl code snippet to parse optionally- > quoted, comma-separated values. > > The most obvious candidate, Text::CSV, won't do the job for two reasons: > > -- it only recognizes doub

Module to parse CSV string

2006-07-19 Thread Chap Harrison
Hi, I'm looking for a module or a perl code snippet to parse optionally- quoted, comma-separated values. The most obvious candidate, Text::CSV, won't do the job for two reasons: -- it only recognizes double-quotes as the quote character. My input uses single-quotes. -- including the quote

Re: check existence of element in a list

2006-07-19 Thread Rob Dixon
joseph wrote: > > "Rob Dixon" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > >>joseph wrote: >> >>>I need help with my script, this supposedly would check a workstation >>>listed in one file then see if it's not listed on other file, if it 's the >>>case then append it on an outpu

Re: check existence of element in a list

2006-07-19 Thread Rob Dixon
joseph wrote: > > "Rob Dixon" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > >>joseph wrote: >> >>>I need help with my script, this supposedly would check a workstation >>>listed in one file then see if it's not listed on other file, if it 's the >>>case then append it on an outpu

Re: write out filenames of files existing on a filesystem into afile

2006-07-19 Thread Prabu
Nishi Bhonsle wrote: Hi: How do I look for the string in the following file so that i can insert something between the tags insert some bla text here in the following file? http:/

Re: non fixed number of properties in constructor

2006-07-19 Thread D. Bolliger
Hi Ken Ken Perl am Mittwoch, 19. Juli 2006 12:04: > ok, let me explain what I mean. Better done by inline/bottom posting, if you already got a bottom answer :-) > $account = new Account; > then I can get the currency of the two countries, > $account->currency_us; > $account->currency_fr; > > aft

Re: check existence of element in a list

2006-07-19 Thread joseph
"Rob Dixon" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > joseph wrote: > > > > I need help with my script, this supposedly would check a workstation > > listed > > in one file then see if it's not listed on other file, if it 's the case > > then append it on an output file.Basic

Re: doubt..

2006-07-19 Thread Prasad
Hi Ramesh, Yes. Here they have used '|' is a delimiter. Take a look at 'perlre'. ""Ankam, Ramesh Babu"" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] .. Hi, Can any one please tell me what this pattern means " s|.*/|| ". Is it that '|' represents '/'. Please reply me soon.

Re: write out filenames of files existing on a filesystem into afile

2006-07-19 Thread Nishi Bhonsle
Hi: How do I look for the string in the following file so that i can insert something between the tags insert some bla text here in the following file? http://www.w3.org/2001/XMLSchema-

Re: doubt..

2006-07-19 Thread Prasad
Ramesh, Here they have used '|' as a delimiter because already they are using the metacharacter '/' in the find pattern. In order to avoid backslashing the metacharacter '/' , they have used '|' as delimiter. Regards, Prasad ""Ankam, Ramesh Babu"" <[EMAIL PROTECTED]> wrote in message news:[EMAI

Re: split function

2006-07-19 Thread Prasad
Hi Sayed, I could not get your exact requirement. Here is one way to get the output shown by you. $string = 'cs_backup_restore_cmvobsvr1mum'; ($first, $second) = $string =~ /(.+)(_[^_]+)/s; print "First: $first\nSecond: $second"; output: First: cs_backup_restore Second: _cmvobsvr1mum Regards

Re: check existence of element in a list

2006-07-19 Thread John W. Krahn
joseph wrote: > Hi list, Hello, > I need help with my script, this supposedly would check a workstation listed > in one file then see if it's not listed on other file, if it 's the case > then append it on an output file.Basically what i got is the same unmodified > list just appended on the o

RE: non fixed number of properties in constructor

2006-07-19 Thread Charles K. Clarkson
Ken Perl wrote: : ok, let me explain what I mean. : $account = new Account; : then I can get the currency of the two countries, : $account->currency_us; : $account->currency_fr; : : after I freeze the code, a new country jumps out, suppose i need : support Iraq, but now I can't use this, : $accou

Re: doubt..

2006-07-19 Thread Ranish George
Ankam, Ramesh Babu wrote: Hi, Can any one please tell me what this pattern means " s|.*/|| ". Is it that '|' represents '/'. Please reply me soon. Thanks in advance --- Ramesh Hello Ramesh, In your example "|" is used as the delimiter instead of the g

Re: split function

2006-07-19 Thread Mumia W.
On 07/19/2006 02:57 AM, Sayed, Irfan (Irfan) wrote: Hi, I need to split following string cs_backup_restore_cmvobsvr1mum the output which i am looking for is cs_backup_restore and _cmvobsvr1mum can anybody plz help regards irfan. Sayed, Irfan; your questions are too basic. Any

Re: non fixed number of properties in constructor

2006-07-19 Thread Mumia W.
On 07/19/2006 05:04 AM, Ken Perl wrote: ok, let me explain what I mean. $account = new Account; then I can get the currency of the two countries, $account->currency_us; $account->currency_fr; after I freeze the code, a new country jumps out, suppose i need support Iraq, but now I can't use this,

Re: doubt..

2006-07-19 Thread Xavier Noria
On Jul 19, 2006, at 13:59, Ankam, Ramesh Babu wrote: Can any one please tell me what this pattern means " s|.*/|| ". Assuming there are no newlines in the string, that s/// means remove everything up to, and including, the last slash. It's a typical regexp for getting the basename of

RE: File transfer over socket connection

2006-07-19 Thread Jerry DuVal
Perfect, exactly what I was looking for! Thanks Jerry >-Original Message- >From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On >Behalf Of zentara >Sent: Wednesday, July 19, 2006 8:48 AM >To: beginners@perl.org >Subject: Re: File transfer over socket connection > >On Tue, 18 Jul 2006 12:0

doubt..

2006-07-19 Thread Ankam, Ramesh Babu
Hi, Can any one please tell me what this pattern means " s|.*/|| ". Is it that '|' represents '/'. Please reply me soon. Thanks in advance --- Ramesh

Re: split function

2006-07-19 Thread Dr.Ruud
"Sayed, Irfan (Irfan)" schreef: > I need to split following string > > cs_backup_restore_cmvobsvr1mum > > the output which i am looking for is > > cs_backup_restore and _cmvobsvr1mum $ perl -Mstrict -wle ' $_ = "cs_backup_restore_cmvobsvr1mum" ; @_ = split /(_)/ ; # print for @_ ; $" = "\t"

Re: non fixed number of properties in constructor

2006-07-19 Thread Ken Perl
ok, let me explain what I mean. $account = new Account; then I can get the currency of the two countries, $account->currency_us; $account->currency_fr; after I freeze the code, a new country jumps out, suppose i need support Iraq, but now I can't use this, $account->currency_iraq; If I want to su

Re: non fixed number of properties in constructor

2006-07-19 Thread Rob Dixon
Ken Perl wrote: I find a difficulty when writing the constructor which may has dynamic and non fixed number of properties, say we want to construct a new class Account, package Account; sub new { my $class = shift; my $self = { currency_us=>undef, currency_fr =>undef, };

Re: check existence of element in a list

2006-07-19 Thread Rob Dixon
joseph wrote: > > I need help with my script, this supposedly would check a workstation listed > in one file then see if it's not listed on other file, if it 's the case > then append it on an output file.Basically what i got is the same unmodified > list just appended on the output file. Where di

RE: split function

2006-07-19 Thread Nagrale, Ajay
> I need to split following string > > cs_backup_restore_cmvobsvr1mum > > the output which i am looking for is > > cs_backup_restore and _cmvobsvr1mum I think this will work fine if you are bothered about the last word after underscore: Ajay> perl -e 'my $str='cs_backup_restore_cmvobsvr1mum'; my

Re: split function

2006-07-19 Thread Xavier Noria
On Jul 19, 2006, at 10:05, Sayed, Irfan ((Irfan)) wrote: I think criteria shud be _ but I need output in following manner That criteria is ambiguous becasue there are several _s and you need to deal with them differently, that is, ignoring some and splitting on some. Can you be more specif

RE: split function

2006-07-19 Thread Sayed, Irfan \(Irfan\)
-Original Message- From: Xavier Noria [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 19, 2006 1:33 PM To: Perl Beginners Subject: Re: split function On Jul 19, 2006, at 9:57, Sayed, Irfan ((Irfan)) wrote: > I need to split following string > > cs_backup_restore_cmvobsvr1mum > > the o

Re: split function

2006-07-19 Thread Xavier Noria
On Jul 19, 2006, at 9:57, Sayed, Irfan ((Irfan)) wrote: I need to split following string cs_backup_restore_cmvobsvr1mum the output which i am looking for is cs_backup_restore and _cmvobsvr1mum Which is the criteria, everything up to the last underscore? -- fxn -- To unsubscribe, e-mail

Re: check existence of element in a list

2006-07-19 Thread joseph
""Jeff Peng"" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > >>my %hash = map { $_ => 1 } @pclist; > > above is wrong.It should be: > my %hash = map { $_, 1 } @pclist; > > HTH. > > Thank you Jeff, unfortunately still it didn't solve the problem. /jbt -- To unsubscribe, e-mail

split function

2006-07-19 Thread Sayed, Irfan \(Irfan\)
Hi, I need to split following string cs_backup_restore_cmvobsvr1mum the output which i am looking for is cs_backup_restore and _cmvobsvr1mum can anybody plz help regards irfan.

Re: File transfer over socket connection

2006-07-19 Thread Peter Cornelius
On Jul 18, 2006, at 9:08 AM, Jerry DuVal wrote: I can talk btwn the client and server with no problem, but I want to send a file over the TCP socket connection. Does any one have any examples? The file is just data, which I'm assuming you can open and read. Since you can also write to th

Re: search option in perl

2006-07-19 Thread Prasad
""Sayed, Irfan (Irfan)"" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] .. Hi all, I need to search a file for a specific string thru perl script. for example i want to put following condition in the script. --- > first search the string string1 > and if that string found then

RE: check existence of element in a list

2006-07-19 Thread Krishnakumar K P
%hash = map { $_ => 1 } @pclist; is correct Krishnakumar K.P Sr.Software Engineer Cybage Software Pvt. Ltd (An SEI-CMMI Level 5 Company) West Avenue, Kalyani Nagar Pune - 411 006 Tel: 020- 66041700/ 66044700 extn: 3178 Email: [EMAIL PROTECTED] Website: www.cybage.com -Original Message--

non fixed number of properties in constructor

2006-07-19 Thread Ken Perl
hi there, I find a difficulty when writing the constructor which may has dynamic and non fixed number of properties, say we want to construct a new class Account, package Account; sub new { my $class = shift; my $self = { currency_us=>undef, currency_fr =>undef, }; bless

RE: check existence of element in a list

2006-07-19 Thread Jeff Peng
my %hash = map { $_ => 1 } @pclist; above is wrong.It should be: my %hash = map { $_, 1 } @pclist; HTH. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

when to use '&' Was: Passing a hash to a function

2006-07-19 Thread Bjørge Solli
On Tuesday 18 July 2006 18:05, Rob Dixon wrote: > Bjørge Solli wrote: > > On Tuesday 18 July 2006 16:45, John W. Krahn wrote: > >>Leonid Grinberg wrote: > >>>sub function > >>>{ > >>> my %operating_systems = &populate_hash(%operating_systems); > >> > >> my %operating_systems = populate_hash

check existence of element in a list

2006-07-19 Thread joseph
Hi list, I need help with my script, this supposedly would check a workstation listed in one file then see if it's not listed on other file, if it 's the case then append it on an output file.Basically what i got is the same unmodified list just appended on the output file. Where did i got wro