
perlbug-followup at perl
May 28, 2008, 9:22 AM
Post #2 of 12
(634 views)
Permalink
|
|
[perl #54974] Strange map {} Behavior When Returning Two Values
[In reply to]
|
|
# New Ticket Created by David Wheeler # Please include the string: [perl #54974] # in the subject line of all future correspondence about this issue. # <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=54974 > perlbug, This is a bug report for perl from david [at] kineticode, generated with the help of perlbug 1.36 running under perl 5.10.0. ----------------------------------------------------------------- When I run this code: my @a = map { "--$_" => $_ } @ARGV; I get this compile-time error: Not enough arguments for map at /Users/david/bin/try line 6, near "} @ARGV" syntax error at /Users/david/bin/try line 6, near "} @ARGV" Execution of /Users/david/bin/try aborted due to compilation errors. When I change the map to: my @a = map { '--' . $_ => $_ } @ARGV; It works. The only difference is using concatentation instead of the double-quoted string "--$_". Curiously, I don't get the compile-time error for this code: my @a = map { "--$_" } @ARGV; So it seems to be something about returning two values from the map sub. FWIW, I get a similar error with Perl 5.8.8: syntax error at /Users/david/bin/try line 6, near "} @ARGV" Execution of /Users/david/bin/try aborted due to compilation errors. I'm fine to use the concatenation workaround, but it seems pretty bizarre, and so worth reporting. Thanks! David ----------------------------------------------------------------- --- Flags: category=core severity=low --- Site configuration information for perl 5.10.0: Configured by david at Mon Apr 14 12:06:56 PDT 2008. Summary of my perl5 (revision 5 version 10 subversion 0) configuration: Platform: osname=darwin, osvers=9.2.2, archname=darwin-2level uname='darwin benedict.local 9.2.2 darwin kernel version 9.2.2: tue mar 4 21:17:34 pst 2008; root:xnu-1228.4.31~1release_i386 i386 ' config_args='-des -Duseshrplib -Dperladmin=david [at] kineticode -Dcf_email=david [at] kineticode' hint=recommended, useposix=true, d_sigaction=define useithreads=undef, usemultiplicity=undef useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef use64bitint=undef, use64bitall=undef, uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cc', ccflags ='-fno-common -DPERL_DARWIN -no-cpp-precomp -fno-strict-aliasing -pipe -I/usr/local/include', optimize='-O3', cppflags='-no-cpp-precomp -fno-common -DPERL_DARWIN -no-cpp-precomp -fno-strict-aliasing -pipe -I/usr/local/include' ccversion='', gccversion='4.0.1 (Apple Inc. build 5465)', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=8, prototype=define Linker and Libraries: ld='env MACOSX_DEPLOYMENT_TARGET=10.3 cc', ldflags =' -L/usr/local/lib' libpth=/usr/local/lib /usr/lib libs=-ldbm -ldl -lm -lutil -lc perllibs=-ldl -lm -lutil -lc libc=/usr/lib/libc.dylib, so=dylib, useshrplib=true, libperl=libperl.dylib gnulibc_version='' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' ' cccdlflags=' ', lddlflags=' -bundle -undefined dynamic_lookup -L/usr/local/lib' Locally applied patches: --- @INC for perl 5.10.0: /usr/local/lib/perl5/5.10.0/darwin-2level /usr/local/lib/perl5/5.10.0 /usr/local/lib/perl5/site_perl/5.10.0/darwin-2level /usr/local/lib/perl5/site_perl/5.10.0 . --- Environment for perl 5.10.0: DYLD_LIBRARY_PATH (unset) HOME=/Users/david LANG=en_US.UTF-8 LANGUAGE (unset) LD_LIBRARY_PATH (unset) LOGDIR (unset) PATH=/opt/local/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/Developer/Tools:/Users/david/bin:/usr/local/pgsql/bin:/usr/local/mysql/bin:/usr/X11/bin PERL_BADLANG (unset) SHELL=/bin/zsh
|