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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T00:44:52+00:00 2026-05-11T00:44:52+00:00

Consider the following code and its output: Code #!/usr/bin/perl -w use strict; use Data::Dumper;

  • 0

Consider the following code and its output:

Code

#!/usr/bin/perl -w use strict; use Data::Dumper; my $HOURS_PER_DAY = 24.0 * 1.0; my $BSA = 1.7 * 1.0; my $MCG_PER_MG = 1000.0 * 1.0; my $HOURS_DURATION    = 20.0 * $HOURS_PER_DAY; my $dummy = $HOURS_PER_DAY * $BSA * $MCG_PER_MG * $HOURS_DURATION; print Dumper($HOURS_PER_DAY); print Dumper( $BSA); print Dumper( $MCG_PER_MG); print Dumper( $HOURS_DURATION ); 

Output

$VAR1 = 24; $VAR1 = '1.7'; $VAR1 = 1000; $VAR1 = 480; 

As you can see, the second variable is treated as strings, while the first and the forth ones are treated as numbers. Anybody has any idea what is the underlying logic?

Edit arithmetic calculations that were added do not completely solve the problem (see the $BSA variable).


$ perl -v  This is perl, v5.10.0 built for cygwin-thread-multi-64int (with 6 registered patches, see perl -V for more detail)  Copyright 1987-2007, Larry Wall 
  • 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. 2026-05-11T00:44:53+00:00Added an answer on May 11, 2026 at 12:44 am

    Data::Dumper’s job is to serialize data and you can’t tell much about what perl is doing internally with the data based on its output. The Devel::Peek module can dump the underlying flags and values stored in the variables. The Devel::Peek POD explains the significance of the flags.

    #!/usr/bin/perl  use warnings; use strict; use Devel::Peek;  my $HOURS_PER_DAY = 24.0 * 1.0; my $BSA = 1.7 * 1.0; my $MCG_PER_MG = 1000.0 * 1.0; my $HOURS_DURATION    = 20.0 * $HOURS_PER_DAY; my $dummy = $HOURS_PER_DAY * $BSA * $MCG_PER_MG * $HOURS_DURATION;  Dump($HOURS_PER_DAY); Dump($BSA); Dump($MCG_PER_MG); Dump($HOURS_DURATION);  __END__ SV = PVNV(0xd71ff0) at 0xd87f90   REFCNT = 1   FLAGS = (PADBUSY,PADMY,IOK,NOK,pIOK,pNOK)   IV = 24   NV = 24   PV = 0 SV = PVNV(0xd71fc8) at 0xd87f60   REFCNT = 1   FLAGS = (PADBUSY,PADMY,NOK,pIOK,pNOK)   IV = 1   NV = 1.7   PV = 0 SV = PVNV(0xd72040) at 0xd87f40   REFCNT = 1   FLAGS = (PADBUSY,PADMY,IOK,NOK,pIOK,pNOK)   IV = 1000   NV = 1000   PV = 0 SV = IV(0xd8b408) at 0xd87f30   REFCNT = 1   FLAGS = (PADBUSY,PADMY,IOK,pIOK)   IV = 480 # compare the above output to output without the assignment to $dummy: SV = IV(0x7b0eb8) at 0x7adf90   REFCNT = 1   FLAGS = (PADBUSY,PADMY,IOK,pIOK)   IV = 24 SV = NV(0x7c7c90) at 0x7adf60   REFCNT = 1   FLAGS = (PADBUSY,PADMY,NOK,pNOK)   NV = 1.7 SV = IV(0x7b13d8) at 0x7adf40   REFCNT = 1   FLAGS = (PADBUSY,PADMY,IOK,pIOK)   IV = 1000 SV = IV(0x7b1408) at 0x7adf30   REFCNT = 1   FLAGS = (PADBUSY,PADMY,IOK,pIOK)   IV = 480 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 75k
  • Answers 75k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer Just little more digging and we found partial solution: Microsoft.Exchange.Data.Common.dll… May 11, 2026 at 2:38 pm
  • added an answer You could perform a manual clone by writing a method… May 11, 2026 at 2:38 pm
  • added an answer Try $member = '$t'; $obj->$member May 11, 2026 at 2:38 pm

Related Questions

What are the best tools/programming-techniques for following a complicated nesting of symlinks and completely
Consider the following code: partial class OurBusinessObject { partial void OnOurPropertyChanged() { if(ValidateOurProperty(this.OurProperty) ==
It seems that floated HTML elements don't expand the heights of their containers. For
This has always bugged me. Perhaps someone with some hardcore knowledge of .NET internals

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.