--- David Gilden <[EMAIL PROTECTED]> wrote:
> The following uppercase'S the whole string, when all I want is the
> first letter.
> sub uppercase{
> ($s) = @_; return uc($s); # works but caps the whole string
> }
Others have already said to use ucfirst. =o)
> lastly, in this hash of hashs..
>
> $bears = {
>
> rec1 => {
> type => 'sweater',
> name => 'sweaterie',
> color => 'golden brown',
> food => 'mixed beries',
> },
>
>
> one of many... more recs heres
>
>
> }
>
>
> is $ (scalar) $bears, correct? should not be %bears
scalar $bears is correct if you want a reference, which is how you were
using it before.
to say $bears->{food} is correct if that's what you want.
If instead you just want a normal hash, change $bears to %bears, but
you must also change the {} around the contents to (), and the
references like $bears->{food} to $bears{food}
> How would I get the lenght of $bears if I wanted to a:
>
> for (0 .. # true lenght of $bears )
Why would you do this?
It isn't an array....
Do you want to know how many keys there are?
try
scalar keys %bears
> and as it is, I can not do the following, that you would use will
> normal hashs
>
> foreach my $key (sort keys %bears ) {
If you're using the reference syntax, dereference it in the loop
structure.
for my $key ( sort keys %{$bears} ) { # . . .
__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]