Re: perl help

2011-09-09 Thread John W. Krahn
Chris Stinemetz wrote: What would be the best way to omit any record when varible $dist is null or not>1 ? But from your code, I assume you mean to omit records when the _length_ of $dist isn't greater than one? I would make the check immediately $dest is assigned, and 'next' over the re

Re: need helps

2011-09-09 Thread Mike McClain
On Thu, Sep 08, 2011 at 04:00:43PM +, Zhu, Qichao wrote: > There are two arrays > @a = [[a,b,c]...[d,e]...[f]...[g,h]...] > @b = [[...],[...,a,..,c,...,b...],[d],[e],[g...h]...] > > How can I make an arithmetic to detected that. > if (element of array @a include by the element of array @b one

Re: perl help

2011-09-09 Thread Mike McClain
Hi Chris, To debug your code simplify it as much as possible to include only the parts that aren't working right which means copy the file to a temporary working file (I usually call mine t.pl) and delete the stuff that's superflous. In your case that would be reading and writing files and the

Re: perl help

2011-09-09 Thread Rob Dixon
On 09/09/2011 09:54, Chris Stinemetz wrote: What would be the best way to omit any record when varible $dist is null or not>1 ? But from your code, I assume you mean to omit records when the _length_ of $dist isn't greater than one? I would make the check immediately $dest is assigned, a

Re: tr/// and unicode

2011-09-09 Thread Mike McClain
On Thu, Sep 08, 2011 at 11:13:02AM +0200, Matthias Leopold wrote: > actually, the code i'm trying to replace uses s///. i wanted to use > something similar to str_replace() in php which uses two arrays for > search and replace (in the php version of the very same task in my > project). but i a

Re: perl help

2011-09-09 Thread Shawn H Corey
On 11-09-09 05:11 AM, Shlomi Fish wrote: next if (any { !length($_) } $dist, $cell, $sect); I would prefer: next if (any { length($_) == 0 } $dist, $cell, $sect); This makes it clearer as to exactly what condition is being tested, a zero-length string. -- Just my 0.0002 mill

Re: perl help

2011-09-09 Thread Shlomi Fish
Hi, On Fri, 9 Sep 2011 11:28:19 +0200 Paul Johnson wrote: > On Fri, Sep 09, 2011 at 12:11:04PM +0300, Shlomi Fish wrote: > > > next if (!length($dist) or !length($cell) or !length($sect)); > > > > There's a better way using List::MoreUtils : > > For some definition of "better". > Well,

Re: perl help

2011-09-09 Thread Paul Johnson
On Fri, Sep 09, 2011 at 12:11:04PM +0300, Shlomi Fish wrote: > next if (!length($dist) or !length($cell) or !length($sect)); > > There's a better way using List::MoreUtils : For some definition of "better". See also De Morgan. -- Paul Johnson - p...@pjcj.net http://www.pjcj.net -- To

Re: perl help

2011-09-09 Thread Shlomi Fish
Hi Chris, thanks for not top-posting. See below for my response. On Fri, 9 Sep 2011 03:54:14 -0500 Chris Stinemetz wrote: > > > >> What would be the best way to omit any record when varible $dist is > >> null or not>  1 ? > > > > But from your code, I assume you mean to omit records when the _l

Re: perl help

2011-09-09 Thread Chris Stinemetz
> >> What would be the best way to omit any record when varible $dist is >> null or not>  1 ? > > But from your code, I assume you mean to omit records when the _length_ > of $dist isn't greater than one? > > I would make the check immediately $dest is assigned, and 'next' over > the record in the