summaryrefslogtreecommitdiff
path: root/sv.c
diff options
context:
space:
mode:
authorMike Guy <mjtg@cam.ac.uk>2000-08-10 16:50:54 +0100
committerJarkko Hietaniemi <jhi@iki.fi>2000-08-11 00:07:53 +0000
commit0a3ece5567993cdf5de26e22ebce420ba267a0f6 (patch)
treea6bc7487d1b9a9184d7721017583b8b7f17b857c /sv.c
parent91e6cb7768546a70d950faf2589360c55fa9771a (diff)
downloadperl-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.c17
1 files changed, 4 insertions, 13 deletions
diff --git a/sv.c b/sv.c
index 382805f362..ab4d6d55e7 100644
--- a/sv.c
+++ b/sv.c
@@ -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);
}
}