Re: what's with 'with'? (was: [aliasing - was:[nice2haveit]])

2001-07-20 Thread 'John Porter '
David L. Nicol wrote: No, that does not work: Right; I misunderstood what was wanted. -- John Porter

Re: what's with 'with'? (was: [aliasing - was:[nice2haveit]])

2001-07-19 Thread Stuart Rocks
But can someone reiterate the difference between the above and for($foo){ print I am not a $foo\n; # or: print I am not a ; print; } Try this under the current for system, cause it's unclear what will happen for those new to Perl: $foo=monkey; $_= coward; for($foo){

RE: what's with 'with'? (was: [aliasing - was:[nice2haveit]])

2001-07-19 Thread Sterin, Ilya
Why would you want it to print Monkey Hero, I would expect $_ to be localized, rather than global, which could prove more convenient. Ilya -Original Message- From: Stuart Rocks To: [EMAIL PROTECTED] Sent: 07/19/2001 1:13 PM Subject: Re: what's with 'with'? (was: [aliasing

Re: what's with 'with'? (was: [aliasing - was:[nice2haveit]])

2001-07-19 Thread 'John Porter '
Sterin, Ilya wrote: Well then maybe $_ can be a reference to a multidimensional array or hash, and temp vars can be access like this. for ( @foo, @bar ) { print $_-[0] : $_-[1]\n; } That's bizarre and unnecessary. We can already do this: for ( \@foo, \@bar ) { print $_-[0] :

RE: what's with 'with'? (was: [aliasing - was:[nice2haveit]])

2001-07-19 Thread Sterin, Ilya
:) Ilya -Original Message- From: 'John Porter ' To: [EMAIL PROTECTED] Sent: 07/19/2001 1:46 PM Subject: Re: what's with 'with'? (was: [aliasing - was:[nice2haveit]]) Sterin, Ilya wrote: Well then maybe $_ can be a reference to a multidimensional array or hash, and temp vars can be access

Re: what's with 'with'? (was: [aliasing - was:[nice2haveit]])

2001-07-19 Thread Stuart Rocks
Why would you want it to print Monkey Hero, I would expect $_ to be localized, rather than global, which could prove more convenient. No, it's still localized. But the With would mean that $_ in a way becomes a normal variable like $foo was, and the $foo is now the 'default variable'.

what's with 'with'? (was: [aliasing - was:[nice2haveit]])

2001-07-19 Thread Garrett Goebel
From: Stuart Rocks [mailto:[EMAIL PROTECTED]] Both the following would work: with($foo){ print I am not a $foo\n; # or: print I am not a ; print; } Okay... I've been mostly ignoring this thread. But can someone reiterate the difference between the above and for($foo){

Re: what's with 'with'? (was: [aliasing - was:[nice2haveit]])

2001-07-19 Thread Mark Koopman
Garrett Goebel wrote: From: Stuart Rocks [mailto:[EMAIL PROTECTED]] Both the following would work: with($foo){ print I am not a $foo\n; # or: print I am not a ; print; } Okay... I've been mostly ignoring this thread. But can someone reiterate the difference between the

RE: what's with 'with'? (was: [aliasing - was:[nice2haveit]])

2001-07-19 Thread Sterin, Ilya
: Garrett Goebel To: 'Stuart Rocks'; [EMAIL PROTECTED] Sent: 07/19/2001 12:34 PM Subject: what's with 'with'? (was: [aliasing - was:[nice2haveit]]) From: Stuart Rocks [mailto:[EMAIL PROTECTED]] Both the following would work: with($foo){ print I am not a $foo\n; # or: print I am

RE: what's with 'with'? (was: [aliasing - was:[nice2haveit]])

2001-07-19 Thread Sterin, Ilya
I question this too, since as you mentioned with, in my experience works nicely to reference and object like with(object) { .foo(); .bar(); } Ilya -Original Message- From: Mark Koopman To: [EMAIL PROTECTED] Sent: 07/19/2001 12:42 PM Subject: Re: what's with 'with'? (was: [aliasing

Re: what's with 'with'? (was: [aliasing - was:[nice2haveit]])

2001-07-19 Thread John Porter
I believe what is really wanted is for for to be able to iterate over lists of arrays or hashes: for my @i ( @foo, @bar ) { ... for my %i ( %foo, %bar ) { ... with real aliasing occuring. If @_ and %_ are the default iterator variables, then imagine: for ( @argset1,

Re: what's with 'with'? (was: [aliasing - was:[nice2haveit]])

2001-07-19 Thread Stuart Rocks
Like I am not a coward which can be easily done with print I am not a $_; will now have to be written in two separate lines, and possibly more if there is more to follow. Ilya Um, of course the original way is still possible!

RE: what's with 'with'? (was: [aliasing - was:[nice2haveit]])

2001-07-19 Thread Sterin, Ilya
To: [EMAIL PROTECTED] Sent: 07/19/2001 12:59 PM Subject: Re: what's with 'with'? (was: [aliasing - was:[nice2haveit]]) I believe what is really wanted is for for to be able to iterate over lists of arrays or hashes: for my @i ( @foo, @bar ) { ... for my %i ( %foo, %bar ) { ... with real