What are the differences between @variable and $variable in Perl?
I have read code with the symbol $ and the symbol @ before a variable name.
For example:
$info = "Caine:Michael:Actor:14, Leafy Drive";
@personal = split(/:/, $info);
What are the difference between a variable containing $ as opposed to @?
All your knowledge about Perl will be crashed with mountains, when you don’t feel context of this language.
As many people, you use in your speech single value (scalars) and many things in a set.
So, the difference between all of them:
i have a cat.
$myCatName = 'Snowball';it jump on bed where sit
@allFriends = qw(Fred John David);And you can count them
$count = @allFriends;but can’t count them at all cause list of names not countable:
$nameNotCount = (Fred John David);So, after all:
So, list is not the same, as an array.
Interesting feature is slices where your mind will play a trick with you:
this code is a magic:
so, after all things:
Perl have an interesting feature about context. your
$and@are sigils, that help Perl know, what you want, not what you really mean.$likes, so scalar@likea, so array