-
Notifications
You must be signed in to change notification settings - Fork 578
lowercase v in %h=(v1=>'x') -- key becomes \001 instead? #4979
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
From [email protected]Created by [email protected]"v" followed by digits makes for a funny hash key -- the digits perl -w -e 'my %h=(v65=>"A?",v7=>"Beep",v63=>"? indeed");' \ Workaround is to quote the keys: %h=("v7" => "no beep now"); Is "v" the magic? "V" is OK.. Same thing happens with 5.6.1 under DOS. Doesn't happen with -piper Perl Info
|
From [Unknown Contact. See original ticket]On Feb 7, William Piper said:
Perl 5.6 supports v-strings ("version strings").
So yes, the "v" is magical. -- |
From @schwernOn Thu, Feb 07, 2002 at 01:47:47PM -0500, Jeff 'japhy' Pinyan wrote:
Shouldn't the => have caused the v65 bareword to be quoted? The => digraph is mostly just a synonym for the comma $ perl -wle 'my %h = (b23 => 42); print keys %h' Should v-string magic override =>'s LHS autoquoting? -- Michael G. Schwern <schwern@pobox.com> http://www.pobox.com/~schwern/ |
From @JohnPeacockMichael G Schwern wrote:
Except that the tokenizer has already created the v-string before it even This is a documentation issue more than anything else; don't use barewords with John -- |
From @tamiasOn Thu, Feb 07, 2002 at 02:28:21PM -0500, John Peacock wrote:
Ugh. One more reason to dislike v-strings. Ronald |
From @jhiOn Thu, Feb 07, 2002 at 03:10:34PM -0500, Ronald J Kimball wrote:
I wasn't aware one needed any more.
-- |
From @ysthIn article <20020207191209.GJ24358@blackrider>, Michael Schwern wrote:
Either it shouldn't or this should be mentioned in I'm inclined to think that it shouldn't. The clincher to me is |
From @jhi
.... and that's the way I think it should work: the hash keys are -- |
From @JohnPeacockYitzchak Scott-Thoennes wrote:
As I pointed out, the tokenizer takes care of the v-string processing I have a series of patches (which are too large to fit in this e-mail ;~) John -- |
From @rgarciaOn 2002.02.07 22:03 Jarkko Hietaniemi wrote:
Note that hash subscripts don't understand vstrings : $ bleadperl -le '$h{"v1"}=42; print $h{v1}' Having => to quote vstrings is probably doable. (But this would be an |
From @jhiOn Thu, Feb 07, 2002 at 10:33:44PM +0100, Rafael Garcia-Suarez wrote:
s/ers/er/
So.... anyone want to fix a yucky feature to be even more consistently
For those who like their yuckiness the way it is. I don't care either -- |
From @JohnPeacockRafael Garcia-Suarez wrote:
No, the *tokenizer* understands that anything in between the {}'s should be a $ perl5.7.2.exe -Dt -le '$h{"v1"}=42; print $h{v1}' EXECUTING... (-e:0) enter The v-string path is only used when the token is potentially a number, which is $ perl5.7.2.exe -le '$key = v1; $h{$key}=42; print $h{$key}' EXECUTING... (-e:0) enter
I'm doubtful that it would be extremely doable because it would involve backing John -- |
From @tamiasOn Thu, Feb 07, 2002 at 05:04:11PM -0500, John Peacock wrote:
[snip]
This is inconsistent with the behavior of numeric literals as hash keys: % perl -le '$h{"01"}=42; $h{1} = 1; print $h{01}' Ronald |
From @JohnPeacockRonald J Kimball wrote:
It's not, because the numeric case jumps directly to scan_num(): toke.c:3595 /* FALL THROUGH */ .... whereas the 'v1' case goes here: toke.c:3680 case 'v': Notice that line above the 'else if' where hash keys are special cased. If I am John -- |
From @tamiasOn Thu, Feb 07, 2002 at 10:44:22PM -0500, John Peacock wrote:
I'd afraid I don't understand. I point out that it's inconsistent because %h = ( 01 => 1 ) sets $h{'1'} to 1. %h = ( v1 => 1 ) sets $h{"\cA"} to 1. Ronald |
From @iabynJarkko Hietaniemi <jhi@iki.fi> wrote:
Should we deprecate V strings then? qv/74.65.80.72/ ????? |
From @jhiOn Fri, Feb 08, 2002 at 12:11:49PM +0000, Dave Mitchell wrote:
That is not really an option unless Larry says so.
-- |
From @JohnPeacockRonald J Kimball wrote:
Fair enough; when you put it that way, the second example *is* inconsistent %h = ( v1 => 1 ); # key is a v-string into %h = ( v1 => 1 ); # key is 'v1' for reasons I already explained. It may *not* be as difficult to make the $h{v1} = 6; create a v-string as a key, instead of the string 'v1'. But someone made the John -- |
Migrated from rt.perl.org#8454 (status was 'resolved')
Searchable as RT8454$
The text was updated successfully, but these errors were encountered: