diff options
author | Mike Guy <mjtg@cam.ac.uk> | 2000-08-10 16:50:54 +0100 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2000-08-11 00:07:53 +0000 |
commit | 0a3ece5567993cdf5de26e22ebce420ba267a0f6 (patch) | |
tree | a6bc7487d1b9a9184d7721017583b8b7f17b857c /sv.c | |
parent | 91e6cb7768546a70d950faf2589360c55fa9771a (diff) | |
download | perl-0a3ece5567993cdf5de26e22ebce420ba267a0f6.tar.gz |
Fixes to looking-like-number to keep behaviour as it was in 5.005_03.
Subject: Re: [ID 20000810.002] $a["1foo"] same as $a[0]
Message-Id: <E13Mtfa-0005Ge-00@libra.cus.cam.ac.uk>
p4raw-id: //depot/perl@6583
Diffstat (limited to 'sv.c')
-rw-r--r-- | sv.c | 17 |
1 files changed, 4 insertions, 13 deletions
@@ -1569,22 +1569,13 @@ Perl_sv_2iv(pTHX_ register SV *sv) goto ret_iv_max; } } - else if (numtype) { - /* The NV may be reconstructed from IV - safe to cache IV, - which may be calculated by atol(). */ - if (SvTYPE(sv) == SVt_PV) - sv_upgrade(sv, SVt_PVIV); - (void)SvIOK_on(sv); - SvIVX(sv) = Atol(SvPVX(sv)); - } - else { /* Not a number. Cache 0. */ - dTHR; - + else { /* The NV may be reconstructed from IV - safe to cache IV, + which may be calculated by atol(). */ if (SvTYPE(sv) < SVt_PVIV) sv_upgrade(sv, SVt_PVIV); (void)SvIOK_on(sv); - SvIVX(sv) = 0; - if (ckWARN(WARN_NUMERIC)) + SvIVX(sv) = Atol(SvPVX(sv)); + if (! numtype && ckWARN(WARN_NUMERIC)) not_a_number(sv); } } |