$x ="('what is happening here?')"; print "${$x}";

This is a bug report for perl from dmi@questrel.com,
generated with the help of perlbug 1.28 running under perl v5.6.0.


-----------------------------------------------------------------
[Please enter your report here]

$x ="('what is happening here?')";
print "${$x}";


[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
    category=core
    severity=low
---
Site configuration information for perl v5.6.0:

Configured by dmi at Sat Jun  3 20:07:43 PDT 2000.

Summary of my perl5 (revision 5.0 version 6 subversion 0) configuration:
  Platform:
    osname=irix, osvers=5, archname=IP22-irix
    uname='irix indy 5.3 11091812 ip22 mips '
    config_args=''
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef use5005threads=undef useithreads=undef
usemultiplicity=undef
    useperlio=undef d_sfio=undef uselargefiles=define 
    use64bitint=undef use64bitall=undef uselongdouble=undef usesocks=undef
  Compiler:
    cc='cc', optimize='-O', gccversion=
    cppflags='-D_POSIX_SOURCE -ansiposix -D_BSD_TYPES -I/usr/local/include
-DLANGUAGE_C'
    ccflags ='-D_POSIX_SOURCE -ansiposix -D_BSD_TYPES -Olimit 4000
-I/usr/local/include -DLANGUAGE_C'
    stdchar='unsigned char', d_stdstdio=define, usevfork=false
    intsize=4, longsize=4, ptrsize=4, doublesize=8
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=8
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=4
    alignbytes=8, usemymalloc=n, prototype=define
  Linker and Libraries:
    ld='ld', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /usr/lib /lib
    libs=-lmalloc -lsun -lm -lc -lcrypt -lbsd -lPW
    libc=/usr/lib/libc.so, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
    cccdlflags='-KPIC', lddlflags='-shared -L/usr/local/lib'

Locally applied patches:
    

---
@INC for perl v5.6.0:
    /usr/local/lib/perl5/5.6.0/IP22-irix
    /usr/local/lib/perl5/5.6.0
    /usr/local/lib/perl5/site_perl/5.6.0/IP22-irix
    /usr/local/lib/perl5/site_perl/5.6.0
    /usr/local/lib/perl5/site_perl/5.005/IP22-irix
    /usr/local/lib/perl5/site_perl/5.005
    /usr/local/lib/perl5/site_perl
    .

---
Environment for perl v5.6.0:
    HOME=/usr/people/dmi
    LANG=
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
   
PATH=/usr/local/bin:/usr/sbin:/usr/bsd:/sbin:/usr/bin:/bin:/usr/bin/X11:/usr/people/dmi/bin
    PERL_BADLANG (unset)
    SHELL=/bin/tcsh
0
Richard
6/8/2000 5:23:47 AM
perl.perl5.porters 48144 articles. 1 followers. Follow

3 Replies
492 Views

Similar Articles

[PageSpeed] 52

On Thu, 08 Jun 2000 07:23:47 +0200, Richard Foley wrote:
>$x ="('what is happening here?')";
>print "${$x}";

Perl thinks it is the same as:

    print $(;

I haven't checked whether the behavior is accidental or not (C<'>
being a namespace delimiter might contribute to this).


Sarathy
gsar@ActiveState.com
0
gsar
6/8/2000 2:25:07 PM
On Thu, Jun 08, 2000 at 07:25:07AM -0700, Gurusamy Sarathy wrote:
> On Thu, 08 Jun 2000 07:23:47 +0200, Richard Foley wrote:
> >$x ="('what is happening here?')";
> >print "${$x}";
> 
> Perl thinks it is the same as:
> 
>     print $(;
> 
> I haven't checked whether the behavior is accidental or not (C<'>
> being a namespace delimiter might contribute to this).
> 

Actually, ' being a namespace delimiter, Perl probably thinks this is the
same as $), rather than $(.


perlvar:

       All Perl variables that begin with digits, control
       characters, or punctuation characters are exempt from the
       effects of the package declaration and are always forced
       to be in package main.


'ab' =~ /(a)(b)/;
$x = "1'what is happening here?'2";
print $$x;   # prints 'b'


Ronald
0
rjk
6/8/2000 2:36:12 PM
Gurusamy Sarathy wrote:
> 
> On Thu, 08 Jun 2000 07:23:47 +0200, Richard Foley wrote:
> >$x ="('what is happening here?')";
> >print "${$x}";
> 
> Perl thinks it is the same as:
> 
>     print $(;

I think it's the same as

    print $);

> I haven't checked whether the behavior is accidental or not (C<'>
> being a namespace delimiter might contribute to this).

Looks like it.  Change to

    $x ="('what is happening here?'=";
    print "${$x}";

and it prints 60.  This would be 

    $= 

in package 

    ('what is happening here?

but accessing the punctuation variables accessed from any package gives
you that variable from package 'main'.

Also add:

    print keys %{"('what is happening here?::"};

to see all symbols in the package: in this case, just "="; in the
original, just ")".

-- 
Rick Delaney
rick.delaney@home.com
0
rick
6/8/2000 11:42:05 PM
Reply: