Re: pointers in per

2008-06-12 Thread Jeff Peng
On Thu, Jun 12, 2008 at 10:22 PM, mani kandan <[EMAIL PROTECTED]> wrote: > Dear gurus > > I have to write a program with configuration file *.CFG, i came to know have > to use pointers > > I am new to pointer in perl can i get some tips about pointers in perl, where > can i get study materials an

Re: pointers - references ??

2005-04-11 Thread Jay Savage
On Apr 11, 2005 4:20 AM, Brent Clark <[EMAIL PROTECTED]> wrote: > Hi all > > If anyone has the time and / or the will to help me understand. > > I know how to create / use references for perl. But would why would you > use it. > And I think more importantly when. > > Im busy reading / learning

Re: pointers - references ??

2005-04-11 Thread Jonathan Paton
> I know how to create / use references for perl. But would why would you > use it. Perl uses references for multidimensional/complex datastructures. Also used when doing OO in perl. > And I think more importantly when. Whenever appropriate. :) I probably make the greatest use of references w

Re: pointers - references ??

2005-04-11 Thread John Doe
Am Montag, 11. April 2005 10.20 schrieb Brent Clark: > Hi all Hi Brent Here's my way to explain it from an "abstract" perspective more or less "outside" of the world of perl: [...] > I know how to create / use references for perl. But would why would you > use it. > And I think more importantly

RE: pointers - references ??

2005-04-11 Thread Ankur Gupta
> If anyone has the time and / or the will to help me understand. > > I know how to create / use references for perl. But would why would you > use it. > And I think more importantly when. > > Im busy reading / learning the Oreilly Advanced Perl Programming book. > But for the likes of me I cant

Re: Pointers and References

2003-11-30 Thread drieux
On Nov 30, 2003, at 6:23 AM, Jason Dusek wrote: What is a pointer and what is a reference? How are they different? As R.Joseph has noted they are different, and of course the obligatory perldoc tutorials. ( op. cit. ) That having been said, we might want to step back to the 'older language' of

Re: Pointers and References

2003-11-30 Thread R. Joseph Newton
Jason Dusek wrote: > Hi Kids, > > What is a pointer and what is a reference? A pointer is a variable which holds a memory address. That is all it holds, except possibly a classification by type, which can be morphed. Pointers are a C/C++ topic, really. We use the term casually someimes when spe

Re: Pointers

2003-11-22 Thread Wiggins d'Anconia
Eric Walker wrote: wow ok then I will try and use the -> notation. No need to stay behind the times. Just a couple of notes, someone already pointed out perlref, there is also: perldoc perllol perldoc perlreftut perldoc perldsc Which should give you a better handle on references. Depending on

Re: Pointers

2003-11-20 Thread drieux
On Thursday, Nov 20, 2003, at 11:51 US/Pacific, Eric Walker wrote: Well see the key is I am passing a value to a sub this is a pointer and I am having trouble getting access to the hash with in the subroutine $Rules is a pointer given to me by a prewritten Database function. &sub(\$Rules); do yo

RE: Pointers

2003-11-20 Thread Paul Kraus
Send the code. -Original Message- From: Eric Walker [mailto:[EMAIL PROTECTED] Sent: Thursday, November 20, 2003 2:52 PM To: Perl Newbies Subject: RE: Pointers Well see the key is I am passing a value to a sub this is a pointer and I am having trouble getting access to the hash with in

RE: Pointers

2003-11-20 Thread Eric Walker
Well see the key is I am passing a value to a sub this is a pointer and I am having trouble getting access to the hash with in the subroutine $Rules is a pointer given to me by a prewritten Database function. &sub(\$Rules); I am actually passing in 2 hashes and need to compare the keys. so I am

RE: Pointers

2003-11-20 Thread Daniel Staal
--As off Thursday, November 20, 2003 12:20 PM -0700, Eric Walker is alleged to have said: ok why the $$ instead of the %$? sorry confused. On Thu, 2003-11-20 at 12:08, Paul Kraus wrote: $$overdate{key} Perldoc perlref --As for the rest, it is mine. $$ would get you the value of a cert

RE: Pointers

2003-11-20 Thread Eric Walker
wow ok then I will try and use the -> notation. No need to stay behind the times. On Thu, 2003-11-20 at 12:23, Bakken, Luke wrote: > ok why the $$ instead of the %$? > > sorry confused. > > \%overData. Now how do > I access this hash. %$overData? Because

RE: Pointers

2003-11-20 Thread Eric Walker
uld address the entire hash as %$hashref Or a single element of that hash as $$hashref{key} HTH Paul -Original Message- From: Eric Walker [mailto:[EMAIL PROTECTED] Sent: Thursday, November 20, 2003 2:20 PM To: Paul Kraus Cc: 'perlgroup'

RE: Pointers

2003-11-20 Thread Paul Kraus
ker [mailto:[EMAIL PROTECTED] Sent: Thursday, November 20, 2003 2:20 PM To: Paul Kraus Cc: 'perlgroup' Subject: RE: Pointers ok why the $$ instead of the %$? sorry confused. On Thu, 2003-11-20 at 12:08, Paul Kraus wrote: $$overdate{key} Perldoc perlref -Ori

RE: Pointers

2003-11-20 Thread Bakken, Luke
> ok why the $$ instead of the %$? > > sorry confused. > > \%overData. Now how do > I access this hash. %$overData? Because you're in essence doing this: ${ $overdata }{$key} When you access a hash value, you're getting a scalar, which is why you use a $. Perhaps this notation would be c

RE: Pointers

2003-11-20 Thread Eric Walker
ok why the $$ instead of the %$? sorry confused. On Thu, 2003-11-20 at 12:08, Paul Kraus wrote: $$overdate{key} Perldoc perlref -Original Message- From: Eric Walker [mailto:[EMAIL PROTECTED] Sent: Thursday, November 20, 2003 2:03 PM To: perlgroup Su

RE: Pointers

2003-11-20 Thread Paul Kraus
$$overdate{key} Perldoc perlref -Original Message- From: Eric Walker [mailto:[EMAIL PROTECTED] Sent: Thursday, November 20, 2003 2:03 PM To: perlgroup Subject: Pointers Hello all, newbie here got a few questions: I am working with pointers and I sort of understand them and then I don'

Re: Pointers versus References

2002-01-12 Thread Jonathan E. Paton
> It's taken me a while to wrap my head around > references, since I thought they were always > Perl-specific. (At least, the term 'reference' doesn't > show up in K&R!) > > Anyway, it finally occurred to me that the term > 'reference' might just be Perlish for what other > languages (C, I'm thin

Re: Pointers versus References

2002-01-12 Thread Ahmed Moustafa
I believe the two terms, reference and pointer, are equivalent. By the way, In Java, they call it reference also, I think. --Ahmed [EMAIL PROTECTED] | http://www.photo.net/users/ahmed Patrick Hall wrote: > Hi pholks, > > It's taken me a while to wrap my head around > references, since I thoug

Re: Pointers versus References

2002-01-12 Thread Jonathan E. Paton
> It's taken me a while to wrap my head around > references, since I thought they were always > Perl-specific. (At least, the term 'reference' doesn't > show up in K&R!) > > Anyway, it finally occurred to me that the term > 'reference' might just be Perlish for what other > languages (C, I'm thin

RE: pointers to subs?

2001-07-03 Thread Tony Cook
On Tue, 3 Jul 2001, Jeff 'japhy' Pinyan wrote: > None, unless 'login' or 'authent' were one of: > > q qq qr qw qx s m y tr > > Those can't be auto-quoted with => (unless 5.6.1 has changed that). bash$ perl -v | grep version This is perl, version 5.004_04 built for i686-linux bash$ perl -le '

Re: pointers to subs?

2001-07-03 Thread Jos I. Boumans
ion.com/~perl/tut hth, Jos Boumans - Original Message - From: "Brett W. McCoy" <[EMAIL PROTECTED]> To: "Pozsar Balazs" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Tuesday, July 03, 2001 7:12 PM Subject: RE: pointers to subs? > On Tu

RE: pointers to subs?

2001-07-03 Thread Paul
--- Jeff 'japhy' Pinyan <[EMAIL PROTECTED]> wrote: > On Jul 3, John Edwards said: > > >It's messy and relies on you naming you subroutines to match the > static data > >stored in %funcs. It will introduce more possible points of failure > in the > >code, make it harder to debug and maintain. Unl

Re: pointers to subs?

2001-07-03 Thread Michael Fowler
On Tue, Jul 03, 2001 at 01:12:34PM -0400, Brett W. McCoy wrote: > Nothing. If you use the => operator, quotes around the keys are not > required. Quotes are also not required when using single word keys hwne > retrieving a value: With => quotes around the keys are not -always- required. The qu

RE: pointers to subs?

2001-07-03 Thread Brett W. McCoy
On Tue, 3 Jul 2001, Pozsar Balazs wrote: > What's the difference between these two?: > > %actions = ( > login => \&welcome, > authent => \&checkpass, > ); > and > %actions = ( > "login" => \&welcome, > "authent" => \&checkpass, > ); Nothing. If you use the => operator, q

RE: pointers to subs?

2001-07-03 Thread Brett W. McCoy
On Tue, 3 Jul 2001, John Edwards wrote: > It's messy and relies on you naming you subroutines to match the static data > stored in %funcs. It will introduce more possible points of failure in the > code, make it harder to debug and maintain. Unless you've got a really good > reason why you need t

Re: pointers to subs?

2001-07-03 Thread Brett W. McCoy
On Tue, 3 Jul 2001, Pozsar Balazs wrote: > I would want to use a hash to keep pointers to functions, and then call > them, but i'm stuck. > So: > > I create: > my %funcs=( > "one"=> \&first, > "two"=> \&second); > > Then how can I call 'first'? Obviously, using %funcs,

RE: pointers to subs?

2001-07-03 Thread Pozsar Balazs
> The => (fat arrow) auto-quotes the left-hand operand as long as it's a > bareword. > > foo => 'bar' > > is the same as > > 'foo' => 'bar' And also my experiences show that this auto-quotation applies for {}'s as well: $hash{"element"} is the same as $hash{element} ?. Balazs Pozsar. --

Re: pointers to subs?

2001-07-03 Thread Paul Johnson
On Tue, Jul 03, 2001 at 06:49:29PM +0200, Pozsar Balazs wrote: > What's the difference between these two?: > > %actions = ( > login => \&welcome, > authent => \&checkpass, > ); > and > %actions = ( > "login" => \&welcome, > "authent" => \&checkpass, > ); Redundant punctu

RE: pointers to subs?

2001-07-03 Thread Jeff 'japhy' Pinyan
On Jul 3, Pozsar Balazs said: > %actions = ( >login => \&welcome, >authent => \&checkpass, > ); > >and > > %actions = ( >"login" => \&welcome, >"authent" => \&checkpass, > ); None, unless 'login' or 'authent' were one of: q qq qr qw qx s m y tr Those can't be auto-quoted

RE: pointers to subs?

2001-07-03 Thread Pozsar Balazs
Hi all, here's my next question :) What's the difference between these two?: %actions = ( login => \&welcome, authent => \&checkpass, ); and %actions = ( "login" => \&welcome, "authent" => \&checkpass, ); bye Balazs Pozsar. --

RE: pointers to subs?

2001-07-03 Thread Jeff 'japhy' Pinyan
On Jul 3, John Edwards said: >It's messy and relies on you naming you subroutines to match the static data >stored in %funcs. It will introduce more possible points of failure in the >code, make it harder to debug and maintain. Unless you've got a really good >reason why you need to do this, I'd

Re: pointers to subs?

2001-07-03 Thread Jeff 'japhy' Pinyan
On Jul 3, Pozsar Balazs said: >my %funcs=( >"one"=> \&first, >"two"=> \&second); > >Then how can I call 'first'? Obviously, using %funcs, i mean :). There are two (general) ways to dereference arrays, hashes, and functions: CREATE REFERENCEARROW SYNTAXSIGIL

RE: pointers to subs?

2001-07-03 Thread John Edwards
Err, why?? Try this my %funcs=( "one"=> \&first, "two"=> \&second, ); sub first { print "First"; } sub second { print "Second"; } &{$funcs{'one'}}; It's messy and relies on you naming you subroutines to match the static data stored in %funcs. It will introduce more p