in reply to The CORRECT thinking behind the {}s and the ()s.

I wouldn't say there was a trick to remembering them, it's just a matter of remembering.

Either learn them or just use (), and if you need a reference, reference the hash or array you created with a backslash.

When the time comes, and you can't be bothered doing that any more then start using {} or [ ] as desired.

I know when I started writing Perl I didn't use {} or [ ] much, but used plenty of \% or \@.

Jasper
  • Comment on Re: The CORRECT thinking behind the {}s and the ()s.

Replies are listed 'Best First'.
(bbfu) (reference to list) Re2: The CORRECT thinking behind the {}s and the ()s.
by bbfu (Curate) on Sep 16, 2002 at 17:30 UTC

    Just to confuse things more... :)

    Either learn them or just use (), and if you need a reference, reference the hash or array you created with a backslash. (em added)

    Just be careful that you remember that that means:

    %hash = (foo => 'foo', bar => 'bar'); $href = \%hash;

    And not:

    $href = \(foo => 'foo', bar => 'bar');

    Because the latter won't do what you might think. (It would be the same as:

    $href = (\'foo', \'foo', \'bar', \'bar'); # which reduces to... $href = \'bar';

    which is almost certainly not what you want.)

    bbfu
    Black flowers blossum
    Fearless on my breath