I see that there are some great posts that talk about 1E0 AND the not so well understood fine points about ".." and ..."!
Great!

I've never encountered 1E0. But I would like to point out that there is very common usage of 0E0!

0E0 is used within the DBI I/F to return a "True" string value with a numeric zero value! Example:

my $query = $db->prepare(" Update $WeatherDB Set precip=$precip, high=$high, low=$low Where state='$state' AND city='$city' "); my $rows_changed = $update->execute() || die "execute failed..blah"; # if the execute method on the $update query "succeeds", ie # the DB exists and this whole thing "makes sense", but just # didn't change any rows, you get the "TRUE" string and # Zero numeric reponse...(0E0); if ($rows_changed == 0) { print "could not update record with $state,$city! Not Found!\n"; } elsif ($rows_changed >1) { print "DB corruption! $rows_changed entries for $state,$city combo\ +n"; }

So although this exponential string representation of a simple int looks weird (and it is), there are some uses for this within Perl. This allows essentially two parms to be passed back as one value...Did it work or not? And if it did work what is the value? "no rows changed" here is a legal thing, otherwise you would have to have two vars, one for sucess or failure and one for number of results.

Perl vars are strings until used in a numeric context. Maybe this is not obvious, but when a string is used in a numeric context, it becomes a number. In the above code, $rows_changed is still in string context. See what happens to $b below.

Anyway, you will see 0E0 if you write DBI code.
You might code for a decade without seeing 1E0 again

#!/usr/bin/perl -w use strict; my $a="0E0"; my $b ="00000035"; print "A as string=$a\n"; $a +=0; print "A as numeric=$a\n"; $b +=0; print "B=$b leading zeroes deleted\n"; # prints # A as string=0E0 # A as numeric=0 # B=35 leading zeroes deleted

In reply to Re: scalar slice assignment doubt by Marshall
in thread scalar slice assignment doubt by perlstarter

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.