Re: another help on input record separator clarity please

2008-05-04 Thread Chas. Owens
On May 4, 2008, at 17:01, Dr.Ruud wrote: snip Ah-ha, perlre is wrong then. It claims that space is 'A GNU extension equivalent to [ \t] , "all horizontal whitespace"', but that must only be true under the bytes pragma. s/claims that space is/claims that blank is/ Be careful with using the b

Re: another help on input record separator clarity please

2008-05-04 Thread Dr.Ruud
"Chas. Owens" schreef: > Dr.Ruud: >> Chas: >>> Is there a reason I am missing to use [[:blank:]] over [ \t]? >> >> The [:blank:] matches (at least) 18 codepoints. unicount.pl: >> http://www.nntp.perl.org/group/perl.perl5.porters/2007/02/msg121080.html >> >> I prefer some of the named ones, like

Re: another help on input record separator clarity please

2008-05-04 Thread Chas. Owens
On Sun, May 4, 2008 at 2:25 PM, Dr.Ruud <[EMAIL PROTECTED]> wrote: snip > > Is there a reason I am missing to use [[:blank:]] over [ \t]? > > The [:blank:] matches (at least) 18 codepoints. unicount.pl: > http://www.nntp.perl.org/group/perl.perl5.porters/2007/02/msg121080.html > > I prefer some

Re: another help on input record separator clarity please

2008-05-04 Thread Dr.Ruud
Chas. Owens schreef: > Dr.Ruud: >> $value{ $1 } = $2 while m/^(\S+)[[:blank:]]+(\S+)/mg; >> or even >> $value{ $1 } = $2 while m/^(\S+)[[:blank:]]*(\S*)/mg; > > Is there a reason I am missing to use [[:blank:]] over [ \t]? The [:blank:] matches (at least) 18 codepoints. unicount.pl:

Re: another help on input record separator clarity please

2008-05-03 Thread Chas. Owens
On Sat, May 3, 2008 at 6:40 AM, Dr.Ruud <[EMAIL PROTECTED]> wrote: snip > $value{ $1 } = $2 while m/^(\S+)[[:blank:]]+(\S+)/mg; > > or even > > $value{ $1 } = $2 while m/^(\S+)[[:blank:]]*(\S*)/mg; snip Is there a reason I am missing to use [[:blank:]] over [ \t]? -- Chas. Owens won

Re: another help on input record separator clarity please

2008-05-03 Thread Dr.Ruud
"Dr.Ruud" schreef: > Richard Lee: >> my $fgh =~ /fgh\s+(\S+)/; >> my $ijk =~ /ijk\s+(\S+)/; >> my $lmk =~ /lmk\s+(\S+)/; > > You might want to use a hash: > > $fil{$1} = $2 while m/\b(fgh|ijk|lmk)\s+(\S+)/g; Looking at your input data, you could also do: $value{ $1 } =

Re: another help on input record separator clarity please

2008-05-03 Thread Joshua Hoblitt
Hi Richard, Your right, that won't actually work. I wasn't paying very close attention was I? It'd have to be something like this to actually work: my ($fgh) = $_ =~ /fgh\s+(\S+)/; -J -- On Fri, May 02, 2008 at 06:26:52PM -0400, Richard Lee wrote: > Joshua Hoblitt wrote: > >Richard, > > > >Th

Re: another help on input record separator clarity please

2008-05-03 Thread Chas. Owens
On Fri, May 2, 2008 at 9:48 PM, Richard Lee <[EMAIL PROTECTED]> wrote: snip > Chas, does this mean as long as we don't call another sub from the block we > declare local, we should be good. Correct? > I like using local on some of these variables.. for some reason. Most > likely due to mislea

Re: another help on input record separator clarity please

2008-05-02 Thread Richard Lee
Chas. Owens wrote: On Fri, May 2, 2008 at 5:08 PM, Joshua Hoblitt <[EMAIL PROTECTED]> wrote: snip They are probably undefinately because the record seperator is being set lexically inside of the loop (and thus won't apply to the outer while). Please consider this code: local $/ = "\

Re: another help on input record separator clarity please

2008-05-02 Thread Chas. Owens
On Fri, May 2, 2008 at 5:08 PM, Joshua Hoblitt <[EMAIL PROTECTED]> wrote: snip > They are probably undefinately because the record seperator is being set > lexically inside of the loop (and thus won't apply to the outer while). > Please > consider this code: > > > local $/ = "\n\n"; snip

Re: another help on input record separator clarity please

2008-05-02 Thread Joshua Hoblitt
Richard, The unitalized warnings are probably coming from one or more of $fgh, $ijk, $lmk being undefined because the regex failed to match anything. You can test this by trying to print the values of these variables. They are probably undefinately because the record seperator is being set lexic

Re: another help on input record separator clarity please

2008-05-02 Thread Dr.Ruud
Richard Lee schreef: > while () { > local $/ = "\n\n"; > ++$count; That $count is already in $. (see perlvar) > my $fgh =~ /fgh\s+(\S+)/; > my $ijk =~ /ijk\s+(\S+)/; > my $lmk =~ /lmk\s+(\S+)/; You might want to use a hash: $fil{$1} = $2 while m/\b(fgh|ijk|lmk)\s+(\

Re: another help on input record separator clarity please

2008-05-02 Thread Richard Lee
Chas. Owens wrote: On Fri, May 2, 2008 at 5:55 PM, Richard Lee <[EMAIL PROTECTED]> wrote: snip while () { local $/ = "\n\n"; snip } snip You want $/ to have an effect on , but it is localized to inside of the loop. You need to say { local $/ = "\n\n"; while ()

Re: another help on input record separator clarity please

2008-05-02 Thread Chas. Owens
On Fri, May 2, 2008 at 5:55 PM, Richard Lee <[EMAIL PROTECTED]> wrote: snip > while () { >local $/ = "\n\n"; snip > } snip You want $/ to have an effect on , but it is localized to inside of the loop. You need to say { local $/ = "\n\n"; while () { } } -- Chas. Owens wonkden.