in reply to (jeffa) 2Re: 1 line array to hash converter
in thread 1 line array to hash converter

Actually, it's the type of brackets - {} - that tells Perl that's it's a hash slice.

--
<http://www.dave.org.uk>

"The first rule of Perl club is you don't talk about Perl club."

  • Comment on Re: (jeffa) 2Re: 1 line array to hash converter

Replies are listed 'Best First'.
Re: Re: (jeffa) 2Re: 1 line array to hash converter
by Sifmole (Chaplain) on Sep 21, 2001 at 22:15 UTC
    Just because your statement confused me a little:

    The type of brackets - {} - tells Perl that it's a hash.
    The @ tells Perl to use list context vs. scalar context.

    Note the difference between:

    @hash{@array} = (1) x scalar(@array); print join(" -- ", keys %hash), "\n"; #AND $hash{@array} = (1) x scalar(@array); print join(" -- ", keys %hash), "\n";