Re: Difference between <> and grep EXPR, <>

2012-01-20 Thread Rob Dixon
On 20/01/2012 13:51, Shawn H Corey wrote: On 12-01-19 11:08 PM, Andrey P wrote: I don't understand why I need to use a list assignment for say scalar(()=<$fh>); but not for say scalar(grep /./,<$fh>); These are not the same. Try this instead: say scalar( grep /^/, <$fh> ); Or even simply

Re: Difference between <> and grep EXPR, <>

2012-01-20 Thread Shawn H Corey
On 12-01-19 11:08 PM, Andrey P wrote: I don't understand why I need to use a list assignment for say scalar(()=<$fh>); but not for say scalar(grep /./,<$fh>); These are not the same. Try this instead: say scalar( grep /^/, <$fh> ); -- Just my 0.0002 million dollars worth,

Re: Difference between <> and grep EXPR, <>

2012-01-20 Thread Igor Dovgiy
2012/1/20 Andrey P > Hi! > I don't understand why I need to use a list assignment for >say scalar(()=<$fh>); > but not for >say scalar(grep /./, <$fh>); > Because grep gives a list context to its second operand, just like the nuke ( ()= ) operator does. ) Remember, a context is what's

Re: Difference between <> and grep EXPR, <>

2012-01-19 Thread Peter Scott
On Fri, 20 Jan 2012 10:08:31 +0600, Andrey P wrote: > I don't understand why I need to use a list assignment for > > say  scalar(()=<$fh>); > > but not for > > say scalar(grep /./, <$fh>); > > From perlop: > > If a is used in a context that is looking for a list, *a > list* comprising al

Difference between <> and grep EXPR, <>

2012-01-19 Thread Andrey P
Hi! I don't understand why I need to use a list assignment for say  scalar(()=<$fh>); but not for say scalar(grep /./, <$fh>); >From perlop: If a is used in a context that is looking for a list, *a list* comprising all input lines *is returned*, one line per list element. >From perlfun