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 7958631
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T04:27:07+00:00 2026-06-04T04:27:07+00:00

I am new to perl, at most places where hash is used a reference

  • 0

I am new to perl, at most places where hash is used a reference to python’s dictionaries is given. A difference which I have noticed is that the hashes don’t preserve the order of elements. I would like to know if there are some more concrete and fundamental differences between the two.

  • 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-04T04:27:08+00:00Added an answer on June 4, 2026 at 4:27 am

    The most fundamental difference is that perl hashes don’t throw errors if you access elements that aren’t there.

    $ python -c 'd = {}; print("Truthy" if d["a"] else "Falsy")'
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
    KeyError: 'a'
    $ perl -we 'use strict; my $d = {}; print $d->{"a"} ? "Truthy\n": "Falsy\n"'
    Falsy
    $ 
    

    Perl hashes auto create elements too unlike python

    $ python -c 'd = dict(); d["a"]["b"]["c"]=1'
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
    KeyError: 'a'
    $ perl -we 'use strict; my $d = {};  $d->{a}{b}{c}=1'
    $
    

    If you are converting perl to python those are the main things that will catch you out.

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

Sidebar

Related Questions

We have an existing Perl application that supports mod_perl . However, our new host
I have some Perl code that translates new-lines and line-feeds to a normalized form.
What are the concepts that must be known by a new Perl developer for
I am new to Perl and I am writing a program that requires the
I'm relatively new to Perl, writing some XML parsing scripts. I have done two
I build database-driven web sites. Previously I have used Perl or PHP with MySQL.
I am new to C++ coding. I wanted to execute a Perl script (that
I have written a Perl Script which connects to a set of URLs one
In short: What is the most elegant solution to keep a perl/python/R/etc script/program running
We have a custom site written in Perl that uses a slightly modified version

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.