Re: Constant not working in hash...

2008-04-05 Thread Peter Scott
On Sat, 05 Apr 2008 12:25:15 +1100, ken Foskey wrote: > Is there any real advantage of > > use constant PART_NUMBER => 'P/N'; > over > my $PART_NUMBER = 'P/N'; > > Yes I know that it can be modified but conventions such as upper case > constants can almost remove that problem. Or totally remov

Re: Constant not working in hash...

2008-04-05 Thread Chas. Owens
On Fri, Apr 4, 2008 at 1:17 PM, <[EMAIL PROTECTED]> wrote: snip > > my $part = $parts{ $key }{ +PART_NUMBER }; snip > Thanks for your help. Your suggestion worked, but what exactly is the > '+' doing in this case? snip from perldoc perlop Unary "+" has no effect whatsoever, even on str

Re: Constant not working in hash...

2008-04-05 Thread pisces . philip
On Apr 4, 10:30 am, [EMAIL PROTECTED] (Rob Dixon) wrote: > [EMAIL PROTECTED] wrote: > > use constant PART_NUMBER=> 'P/N'; > > > print PART_NUMBER; > > > The above prints, "P/N", as I would expect. Later in the script I > > want to access a hash value using the constant like this: > > m

Re: Constant not working in hash...

2008-04-05 Thread pisces . philip
On Apr 4, 9:37 am, [EMAIL PROTECTED] (Jeff Pang) wrote: > On Fri, Apr 4, 2008 at 11:42 PM, <[EMAIL PROTECTED]> wrote: > > use constant PART_NUMBER=> 'P/N'; > > > print PART_NUMBER; > > > The above prints, "P/N", as I would expect. Later in the script I > > want to access a hash val

Re: Constant not working in hash...

2008-04-04 Thread Rob Dixon
ken Foskey wrote: > On Sat, 2008-04-05 at 00:37 +0800, Jeff Pang wrote: >> On Fri, Apr 4, 2008 at 11:42 PM, <[EMAIL PROTECTED]> wrote: >>> use constant PART_NUMBER=> 'P/N'; >>> >>> print PART_NUMBER; >>> >>> The above prints, "P/N", as I would expect. Later in the script I >>> want

Re: Constant not working in hash...

2008-04-04 Thread ken Foskey
On Sat, 2008-04-05 at 00:37 +0800, Jeff Pang wrote: > On Fri, Apr 4, 2008 at 11:42 PM, <[EMAIL PROTECTED]> wrote: > > use constant PART_NUMBER=> 'P/N'; > > > > print PART_NUMBER; > > > > The above prints, "P/N", as I would expect. Later in the script I > > want to access a hash val

Re: Constant not working in hash...

2008-04-04 Thread Rob Dixon
[EMAIL PROTECTED] wrote: > use constant PART_NUMBER=> 'P/N'; > > print PART_NUMBER; > > The above prints, "P/N", as I would expect. Later in the script I > want to access a hash value using the constant like this: > my $part = $parts{ $key }{ PART_NUMBER }; <- this doesn't work, but

Re: Constant not working in hash...

2008-04-04 Thread Jeff Pang
On Fri, Apr 4, 2008 at 11:42 PM, <[EMAIL PROTECTED]> wrote: > use constant PART_NUMBER=> 'P/N'; > > print PART_NUMBER; > > The above prints, "P/N", as I would expect. Later in the script I > want to access a hash value using the constant like this: > my $part = $parts{ $key }{ PAR