Re: Forcing array context

2005-08-20 Thread Peter Rabbitson
> perldoc -q "What is the difference between a list and an array" As a side note to the POD above - although lists can not change sizes they are addressable just like arrays. In other words the following two statements are equivalent: my @slice = @{ [ (split /\|/, 'a|b|c|d|e') ] }[1,3]; my @s

Re: Memory Testing

2005-08-20 Thread Tom Allison
[EMAIL PROTECTED] wrote: Hi All, I am in need to do some memory stress testing. Is there a way to use C style malloc or calloc, to allocate blocks at a time ?? Thanks in advance, Mark G. Would this be of any help? use Devel::Size qw(size total_size); -- To unsubscribe, e-mail: [EMAIL PRO

Re: Forcing array context

2005-08-20 Thread John W. Krahn
Binish A R wrote: > How can I force array context ... Sorry, you can't. You can have either list context or scalar context or void context. perldoc -f wantarray > like > > # echo hello: world | perl -lne '$aref = split(/:/, $_); print $aref' > > but thatz giving the length of the array Tha

RE : Forcing array context

2005-08-20 Thread Jose Nyimi
Try this: echo hello: world | perl -lne '$aref = [ split(/:/, $_) ]; print $aref' [] synthax gives a ref to the array returned by split() HTH, José. -Message d'origine- De : Binish A R [mailto:[EMAIL PROTECTED] Envoyé : samedi 20 août 2005 17:15 À : Perl Beginners Objet : Forcing array

Re: Forcing array context

2005-08-20 Thread Peter Rabbitson
On Sat, Aug 20, 2005 at 08:44:34PM +0530, Binish A R wrote: > How can I force array context ... > like > > # echo hello: world | perl -lne '$aref = split(/:/, $_); print $aref' > > but thatz giving the length of the array ... I want $aref to be a reference > ... > How is that possible ?? Very

Forcing array context

2005-08-20 Thread Binish A R
How can I force array context ... like # echo hello: world | perl -lne '$aref = split(/:/, $_); print $aref' but thatz giving the length of the array ... I want $aref to be a reference ... How is that possible ?? A workaround is to use the following # echo hello: world | perl -lne '@ar = s

round up to nearest...

2005-08-20 Thread Bryan Harris
Not exactly perl, but ... Is there a simple formula to round some value X up to the next multiple of some other value T? I remember seeing another formula for rounding a value X to the nearest multiple of T -- I'd love that one too, if someone has a list of handy formulas. Or is there a module