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

  • Home
  • SEARCH
  • 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 8022265
In Process

The Archive Base Latest Questions

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

Has something changed in Perl or has it always been this way, that examples

  • 0

Has something changed in Perl or has it always been this way, that examples like the second ($number eq 'a') don’t throw a warning?

#!/usr/bin/env perl
use warnings;
use 5.12.0;

my $string = 'l';
if ($string == 0) {};

my $number = 1;
if ($number eq 'a') {};


# Argument "l" isn't numeric in numeric eq (==) at ./perl.pl line 6.
  • 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-04T22:13:08+00:00Added an answer on June 4, 2026 at 10:13 pm

    Perl will be try to convert a scalar to the type required by the context where it is used.

    There is a valid conversion from any scalar type to a string, so this is always done silently.

    Conversion to a number is also done silently if the string passes a looks_like_number test (accessible through Scalar::Util). Otherwise a warning is raised and a ‘best guess’ approximation is done anyway.

    my $string = '9';
    if ( $string == 9 ) { print "YES" };
    

    Converts the string silently to integer 9, the test succeeds and YES is printed.

    my $string = '9,8';
    if ( $string == 9 ) { print "YES" };
    

    Raises the warning Argument "9,8" isn't numeric in numeric eq (==), converts the string to integer 9, the test succeeds and YES is printed.

    To my knowledge it has always been this way, at least since v5.0.

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

Sidebar

Related Questions

My only guess is something horrible like this: # files where something has been
My code has something like this: HttpFileCollection files Instead of looping through each file
Almost every ios app now has something like Feed option. Programming that usually includes
Ever since I started programming this has been something I have been curious about.
Has something was changed in the way IE9 treats the title attribute in an
I had this working(ish) before, but apparently something has changed on my system and
I am not sure if something has changed in the iPhone SDK 3.0 but
Perhaps this has something to do with it being the mainForm, but I'll ask
How would I do this? I think this has something to do with editing
Has anyone run perl script given at http://oreilly.com/pub/h/974#code ? This is a famous one,

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.