Re: Can someone explain references?

2011-11-27 Thread Dr.Ruud
On 2011-11-25 10:50, timothy adigun wrote: Mike Dekimduna...@gmail.com wrote: # this function expects an array to be passed by reference sub foo { my ($thing1) = @_; # make a lexical variable for the array being passed Fine, but since you are getting a reference, I don't really think

Re: Can someone explain references?

2011-11-27 Thread Dr.Ruud
On 2011-11-25 10:50, timothy adigun wrote: for (@$thing1) # to access the whole array after referencing for clarity use: for (@{$thing1}){...} For clarity, I prefer it like this: for my $t ( @$thing1 ) { ...; } So with plenty of cheap white space. -- Ruud -- To

Re: Can someone explain references?

2011-11-27 Thread Dr.Ruud
On 2011-11-25 10:50, timothy adigun wrote: Mike Dekimduna...@gmail.com wrote: my @array = (1,2,3,4); my $array=[qw(1 2 3 4)]; Another ill advice. There is no need to add a dereferencing level here. A scalar has no inherent type, a construct like \@data has. ('type' in the Perl sense:

Re: Can someone explain references?

2011-11-25 Thread timothy adigun
Hi Mike D, Some comments on your codes: Mike D ekimduna...@gmail.com wrote: Considering the following code, are all my comments correct? # this function expects an array to be passed by reference sub foo { my ($thing1) = @_; # make a lexical variable for the array being passed Fine,

Re: Can someone explain references?

2011-11-25 Thread John W. Krahn
Mike D wrote: Hi all, Hello, just started using Perl today, coming over from a background in C#/Java and Python. I seem to be grasping Perl rather nicely (I think) until I got up to references in Beginning Perl. Considering the following code, are all my comments correct? They appear to

Re: Can someone explain references?

2011-11-25 Thread John W. Krahn
timothy adigun wrote: Hi Mike D, Some comments on your codes: Mike Dekimduna...@gmail.com wrote: Considering the following code, are all my comments correct? # this function expects an array to be passed by reference sub foo { my ($thing1) = @_; # make a lexical variable for the array

Re: Can someone explain references?

2011-11-25 Thread Shlomi Fish
Hi Mike, On Thu, 24 Nov 2011 23:28:39 -0500 Mike D ekimduna...@gmail.com wrote: Hi all, just started using Perl today, coming over from a background in C#/Java and Python. Welcome to Perl. I seem to be grasping Perl rather nicely (I think) until I got up to references in Beginning Perl.

Re: Can someone explain references?

2011-11-25 Thread Shlomi Fish
On Fri, 25 Nov 2011 10:50:01 +0100 timothy adigun 2teezp...@gmail.com wrote: Hi Mike D, Some comments on your codes: Mike D ekimduna...@gmail.com wrote: Considering the following code, are all my comments correct? # this function expects an array to be passed by reference sub foo

Re: Can someone explain references?

2011-11-25 Thread timothy adigun
Hello, == John, TIMTOWTDI =There Is More Than One Way To Do It , I know that! I was stating/showing option(s). Since, the programmer will take resposiblity for it own coding styles! === Fish, «my ($thing1) = @_;» is OK. «my $thing1 = @_;» is not OK, as it will take scalar(@_); which is the

Re: Can someone explain references?

2011-11-25 Thread Rob Dixon
On 25/11/2011 12:39, timothy adigun wrote: == John, TIMTOWTDI =There Is More Than One Way To Do It , I know that! I was stating/showing option(s). Since, the programmer will take resposiblity for it own coding styles! I think John's point is that you were simply rewriting code for the sake

Re: Can someone explain references?

2011-11-25 Thread Rob Dixon
On 25/11/2011 09:56, John W. Krahn wrote: Mike D wrote: It's pretty confusing, especially since BP uses prototypes during the example British Petroleum? Beginning Perl -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org

Re: Can someone explain references?

2011-11-25 Thread John SJ Anderson
On Fri, Nov 25, 2011 at 07:39, timothy adigun 2teezp...@gmail.com wrote: The first two links are to pirated copies of O'Reilly books.     What is your point? The point is this: Please don't post links to pirated materials on this list. Doing so again will get you removed from the list. john,

Re: Can someone explain references?

2011-11-25 Thread Shawn H Corey
On 11-11-24 11:28 PM, Mike D wrote: It's pretty confusing, especially since BP uses prototypes during the example, which I'm told are bad? Never use them? Prototypes in Perl are not the same as in C. Don't use them. Using them is an advance technique that changes the syntax of the language.

Re: Can someone explain references?

2011-11-25 Thread timothy adigun
Hi Rob, The first two links are to pirated copies of O'Reilly books. What is your point? Shlomi's point is presumably that it is inappropriate to encourage piracy on this list. Thanks, I appericiate that and I also support Shlomi's view then! Hi John aka List Mom, The point is this:

Re: Can someone explain references?

2011-11-25 Thread Shawn H Corey
On 11-11-25 09:51 AM, timothy adigun wrote: Hi Rob, The first two links are to pirated copies of O'Reilly books. What is your point? Shlomi's point is presumably that it is inappropriate to encourage piracy on this list. Thanks, I appericiate that and I also support Shlomi's view

Re: Can someone explain references?

2011-11-25 Thread John W. Krahn
Rob Dixon wrote: On 25/11/2011 09:56, John W. Krahn wrote: Mike D wrote: It's pretty confusing, especially since BP uses prototypes during the example British Petroleum? Beginning Perl Thanks. :-) John -- Any intelligent fool can make things bigger and more complex... It takes a

Can someone explain references?

2011-11-24 Thread Mike D
Hi all, just started using Perl today, coming over from a background in C#/Java and Python. I seem to be grasping Perl rather nicely (I think) until I got up to references in Beginning Perl. Considering the following code, are all my comments correct? # this function expects an array to be