Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8317265
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T21:33:12+00:00 2026-06-08T21:33:12+00:00

What are the differences between @variable and $variable in Perl? I have read code

  • 0

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 @?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T21:33:13+00:00Added an answer on June 8, 2026 at 9:33 pm

    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:

    print $myCatName = 'Snowball';           # scalar
    print @allFriends = qw(Fred John David); # array! (countable)
    print $count = @allFriends;              # count of elements (cause array)
    print $nameNotCount = qw(Fred John David); # last element of list (uncountable)
    

    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:

    my @allFriends = qw(Fred John David);
    $anotherFriendComeToParty =qq(Chris);
    $allFriends[@allFriends] = $anotherFriendComeToParty; # normal, add to the end of my friends
    say  @allFriends;
    @allFriends[@allFriends] = $anotherFriendComeToParty; # WHAT?! WAIT?! WHAT HAPPEN? 
    say  @allFriends;
    

    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.

    $ like s, so scalar
    @ like a, so array

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have read some posts about the differences between these 3 relationships and I
In Perl, what is the difference between ' and ? For example, I have
Possible Duplicate: What are the differences between pointer variable and reference variable in C++?
I didn't have a understanding on difference between intializing a variable with {} and
Possible Duplicate: What are the differences between pointer variable and reference variable in C++?
Possible Duplicate: What are the differences between pointer variable and reference variable in C++?
Possible Duplicate: What are the differences between pointer variable and reference variable in C++?
Refering to Variable Scoping. I'm trying to figure out what are the differences between
I have some questions in C# what are the differences between null comparisons null
I am confused on the differences between these two code blocks: $(#someButton).click(function() { var

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.