Re: Simple OOPs related query.

2009-12-21 Thread Shlomi Fish
On Tuesday 22 Dec 2009 04:20:30 Parag Kalra wrote: > Hi Shlomi, > > Thanks for your valuable comments. Will definitely keep it in mind in > future scripts. You're welcome. > > > > I've ran it and I still cannot figure out the bug. > > > > Here is the bug - > > pa...@station3:/tmp$ perl /t

Re: regex question

2009-12-21 Thread Jim Green
2009/12/22 Jim Gibson : > s/^\.\s*//; Thanks Jim, I will figure out as I read "learning perl". > > > -- > To unsubscribe, e-mail: beginners-unsubscr...@perl.org > For additional commands, e-mail: beginners-h...@perl.org > http://learn.perl.org/ > > > -- To unsubscribe, e-mail: beginners-unsubscr

Re: regex question

2009-12-21 Thread Jim Gibson
At 11:49 PM -0600 12/21/09, Jim Green wrote: Hi, I have a text file with lines like this · Experience in C/C++ realtime system programming · Experience in ACE, FIX Could anybody tell me which regex to use to get rid of the dot and the leading spaces before each Line? s/^\.

Re: regex question

2009-12-21 Thread Jim Green
2009/12/21 Uri Guttman : >> "JG" == Jim Green writes: > >  JG> I have a text file with lines like this > > >  JG> ·         Experience in C/C++ realtime system programming > >  JG> ·         Experience in ACE, FIX > > >  JG> Could anybody tell me which regex to use to get rid of the dot and th

Re: regex question

2009-12-21 Thread Uri Guttman
> "JG" == Jim Green writes: JG> I have a text file with lines like this JG> · Experience in C/C++ realtime system programming JG> · Experience in ACE, FIX JG> Could anybody tell me which regex to use to get rid of the dot and the JG> leading spaces before each L

regex question

2009-12-21 Thread Jim Green
Hi, I have a text file with lines like this · Experience in C/C++ realtime system programming · Experience in ACE, FIX Could anybody tell me which regex to use to get rid of the dot and the leading spaces before each Line? Thanks for any help! Jim -- To unsubscribe, e-mail

Re: Simple OOPs related query.

2009-12-21 Thread Parag Kalra
Hi Shlomi, Thanks for your valuable comments. Will definitely keep it in mind in future scripts. I've ran it and I still cannot figure out the bug. Here is the bug - pa...@station3:/tmp$ perl /tmp/oops.pl Chetak goes Neigh Chetak eats Long grass Chetak has Brown color An unamed Horse goes Ne

Re: what's a database handler

2009-12-21 Thread Jenda Krynicky
From: Xiao Lan (a°a...°) > Hi, > > When I get a database handler with DBI, > > my $dbh = DBI->connect(...); That's a "handle" not a "handler". A very different thing. Jenda = je...@krynicky.cz === http://Jenda.Krynicky.cz = When it comes to wine, women and song, wizards are allowed to g

Re: Regex problem

2009-12-21 Thread Robert Wohlfarth
On Mon, Dec 21, 2009 at 9:11 AM, jbl wrote: > The desired output would be > 91416722243rd St > > I am getting this as output > > 91416722rd St <- just the rd St > > > while ( defined ( my $line = ) ) { > $line =~ s/(\s)243 /$1243rd /g; > print MY_OUTPUT_FILE $line; > } > T

Re: Regex problem

2009-12-21 Thread Shawn H Corey
jbl wrote: > I have a lengthy list of data that I read in. I have substituted a one > line example using __DATA__. > The desired output would be > 91416722 243rd St > > I am getting this as output > > 91416722rd St <- just the rd St > > The capturing reference on (\s)..$1 > > is

Re: being smart about script structure

2009-12-21 Thread Shlomi Fish
On Monday 21 Dec 2009 18:09:32 Bryan R Harris wrote: > > Wagner, David --- Senior Programmer Analyst --- CFS wrote: > >> You pass as a refernce as ni > >> called_sub(\...@d); > >> Now when you update, you are updating @d and not a copy. > > > > No need to use a reference for that: > > > > perl -wle

Regex problem

2009-12-21 Thread jbl
I have a lengthy list of data that I read in. I have substituted a one line example using __DATA__. The desired output would be 91416722243rd St I am getting this as output 91416722rd St <- just the rd St The capturing reference on (\s)..$1 is not working # Intent # Look for

Re: being smart about script structure

2009-12-21 Thread Bryan R Harris
> On Wed, 16 Dec 2009 17:47:16 -0600, Bryan R Harris wrote: >>> Okay, here's one I struggle with often -- is one of these better than >>> the other? >>> >>> ** >>> A. >>> if ( isFlat($tire) ) { changeTire($tire); } >>> >>> B. >>> checkFlat

Re: being smart about script structure

2009-12-21 Thread Bryan R Harris
> On Wed, 16 Dec 2009 17:47:16 -0600, Bryan R Harris wrote: >> Okay, here's one I struggle with often -- is one of these better than >> the other? >> >> ** >> A. >> if ( isFlat($tire) ) { changeTire($tire); } >> >> B. >> checkFlatAndChange

Re: being smart about script structure

2009-12-21 Thread Bryan R Harris
> Wagner, David --- Senior Programmer Analyst --- CFS wrote: > >> You pass as a refernce as ni >> called_sub(\...@d); >> Now when you update, you are updating @d and not a copy. > > No need to use a reference for that: > > perl -wle ' > > sub inc{ ++$_ for @_ } > > my @x = 1 .. 5; >

Re: being smart about script structure

2009-12-21 Thread Bryan R Harris
>> What's the difference between pointers and references?  Where can I read >> about that difference? > > The key difference in my mind is this: Perl references are defined in > terms of perl datatypes. C pointers are defined (more or less) in > terms of memory locations. > > If you think about

Re: Regexp to remove spaces

2009-12-21 Thread Jim Gibson
At 6:11 PM +0800 12/21/09, Albert Q wrote: 2009/12/20 Dr.Ruud > > For a multi-line buffer you can do it like this: perl -wle ' my $x = <<"EOT"; 123456 \t abc def \t\t\t\t\t\t\t\t *** *** *** \t EOT s/^\s+//mg, s/\s+$//mg, s/[^\S\n]+/ /g for $x; I kno

Re: being smart about script structure

2009-12-21 Thread Bryan R Harris
>> Is there any way to make a new variable, @something, that is just another >> name for the array that was passed in by reference? Since I'm building a >> complex data structure, having to include all those @{}'s can get annoying. > > Elements of a hash referenced by $h can be accessed by $h->

Re: Regexp to remove spaces

2009-12-21 Thread Albert Q
2009/12/20 Dr.Ruud > > sftriman wrote: > >> I use this series of regexp all over the place to clean up lines of >> text: >> >> $x=~s/^\s+//g; >> $x=~s/\s+$//g; >> $x=~s/\s+/ /g; >> >> in that order, and note the final one replace \s+ with a single space. >> > > The g-modifier on the first 2 is bog

Re: Regexp to remove spaces

2009-12-21 Thread Dr.Ruud
Shawn H Corey wrote: $text =~ tr{\t}{ }; $text =~ tr{\n}{ }; $text =~ tr{\r}{ }; $text =~ tr{\f}{ }; $text =~ tr{ }{ }s; That can be written as: tr/\t\n\r\f/ /, tr/ / /s for $text; But it doesn't remove all leading nor all trailing spaces. -- Ruud -- To unsubscribe, e-mail: beginners-uns

Re: Regexp to remove spaces

2009-12-21 Thread Dr.Ruud
sftriman wrote: I use this series of regexp all over the place to clean up lines of text: $x=~s/^\s+//g; $x=~s/\s+$//g; $x=~s/\s+/ /g; in that order, and note the final one replace \s+ with a single space. The g-modifier on the first 2 is bogus (unless you would add an m-modifier). I current

Re: what's a database handler

2009-12-21 Thread Erez Schatz
2009/12/21 Xiao Lan (小兰) : > my $dbh = DBI->connect(...); > my $pid = fork; > if ($pid ) { # parent >    do something; > } else { # child >    do something another; >    $dbh->disconnect; > } > > What I want to know is, when $dbh get disconnected in child, will it > influence the one in parent? I