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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T04:51:17+00:00 2026-06-17T04:51:17+00:00

First of all, I come from C, Java, Python background. Recently, I started learning

  • 0

First of all, I come from C, Java, Python background. Recently, I started learning Perl for my new job and I got curious about '0' (0-string) being false.

I’ve read that this particular behaviour is the reason why Perl had to have <> operator for reading files so it feels more like a design flaw to me than anything right now. However, I also know that Perl is a mature language and I am guessing this behaviour has its uses otherwise it would have been fixed long time ago.

So in what cases would '0' = false be useful?

  • 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-17T04:51:18+00:00Added an answer on June 17, 2026 at 4:51 am

    Perl has no explicit typing, and its interpretation of type is highly context-dependent. For example:

    $a = "2b";
    $b = "3a";
    $c = $a + $b;
    print $c;
    

    yields 5.

    on the other hand…

    $a = "b2";
    $b = "3a";
    $c = $a + $b;
    print $c;
    

    yields 3.

    and…

    $a = "b2";
    $b = "3a";
    $c = $a.$b;
    print $c;
    

    yields b23a

    So “‘0’ (string)” is not a string, or a number, or a bool, until you use it, and then it can be any of those things, determined by its use. Type is not determined until you try to operate. Then Perl assesses the context to endeavour your intention and acts accordingly. This is a Feature, and why there are Many Ways to Do Things in Perl. It can of course lead to a plenty of confusing code but is excellent for 1-liners, obfuscation and Perl golf.

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

Sidebar

Related Questions

First off, I come from a RDBMS/SQL/C++/Java/Python background and I'm a newbie to Gaelyk,
First of all, I'm quite new to the Android and JAVA world (coming from
I've been iPhone programming for 6 months and come from a PC/Java/Eclipse background and
I come from an Actionscript3 background and this is my first time writing any
I come from an Eclipse/Vim background, and I've just started using Emacs for the
All, I come from java and php world so this maybe a factor. But
I started a new job in a company that loves using the word, enterprise.
I have wrote my first java applet. It basically loads some images from my
Hi Everyone I am newbie to Express + NodeJS. I come from Java and
I've recently started working with java and I'm facing some issues with the apache

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.