Same output here, with perl 5, version 20, subversion 2 (v5.20.2) built for x86_64-linux-thread-multi.
I'm from package main My name is glob I'm from package main My name is glob Le 03/05/2015 10:01, Octavian Rasnita a écrit : > Hello, > > I've seen the following example in Mastering Perl book, with the comment > at the end telling what should be the result: > > #!/usr/bin/perl > # typeglob-name-package.pl > use v5.10; > > $foo = "Some value"; > $bar = "Another value"; > > who_am_i( *foo ); > who_am_i( *bar ); > > sub who_am_i { > local *glob = shift; > > say "I'm from package " . *glob{PACKAGE}; > say "My name is " . *glob{NAME}; > } > > Although this probably has limited usefulness, at least outside of any > debugging, the > output tells me more about the typeglobs I passed to the function: > > I'm from package main > My name is foo > I'm from package main > My name is bar > > --- end of text from book --- > > I ran the code above with StrawberryPerl 5.20 and ActivePerl 5.16 and > 5.14 and it gave the following result: > > I'm from package main > My name is glob > I'm from package main > My name is glob > > So it doesn't print the original name of the typeglob (foo or bar). > Is the code above working for you as wrote in the book? > > --Octavian > > -- Vincent Lequertier s...@riseup.net -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/