Re: special magic in "%!" ?
by janx (Monk) on Mar 08, 2003 at 17:26 UTC
|
%! (aka %ERRNO) is only defined if you use Errno;
Thus, %c cannot be defined either and does not become anything special
when you print it.
Regards,
janx | [reply] [d/l] |
|
perl -le 'print for keys ::'
to
perl -le 'print for keys(%!); print for keys ::'
update: This is perl, v5.8.0 built for i686-linux | [reply] [d/l] [select] |
|
You are rigth, thx :)
It loads some modules if you use %!:
lorien:~$ perl -le 'print %INC'
lorien:~$ perl -le '%!;print %INC'
strict.pm/usr/share/perl/5.8.0/strict.pmExporter.pm/usr/share/perl/5.8
+.0/Exporter.pmConfig.pm/usr/lib/perl/5.8.0/Config.pmErrno.pm/usr/lib/
+perl/5.8.0/Errno.pm
$anarion=\$anarion;
s==q^QBY_^=,$_^=$[x7,print
| [reply] [d/l] |
|
The keys of the hash are defined:
lorien:~$ perl -le 'print %!'
EBADR0ENOMSG0ENOTSUP0ESTRPIPE0EADDRINUSE0EL3HLT0EBADF0ENAVAIL0ECHRNG0E
+NOTBLK0ENOTNAM0ELNRNG0EXDEV0EBADE0EBADSLT0ECONNREFUSED0ENOSTR0EISCONN
+0EOVERFLOW0ENONET0EFBIG0ECONNRESET0ELIBMAX0EWOULDBLOCK0EREMOTEIO0ENOP
+KG0ELIBSCN0EMEDIUMTYPE0EDESTADDRREQ0ENOTSOCK0EIO0EINPROGRESS0ERANGE0E
+ADDRNOTAVAIL0EAFNOSUPPORT0EINTR0EILSEQ0EREMOTE0ENOMEM0ENETUNREACH0EPI
+PE0ENODATA0EUSERS0EOPNOTSUPP0EPROTO0EISNAM0ESPIPE0EALREADY0ENAMETOOLO
+NG0ENOEXEC0EISDIR0EBADRQC0EEXIST0EDOTDOT0ELIBBAD0ESRCH0EFAULT0EAGAIN0
+EDEADLOCK0EXFULL0ENOPROTOOPT0ENETDOWN0EPROTOTYPE0EL2NSYNC0ENETRESET0E
+ADV0EUCLEAN0EROFS0ESHUTDOWN0EMULTIHOP0EPROTONOSUPPORT0ENFILE0ENOLCK0E
+CONNABORTED0ECANCELED0EDEADLK0ENOLINK0ESRMNT0ENOTDIR0ETIME0EINVAL0ENO
+TTY0ENOANO0ELOOP0ENOENT0EPFNOSUPPORT0EBADMSG0ENOMEDIUM0EL2HLT0EDOM0EB
+FONT0EMSGSIZE0ENOCSI0EL3RST0ENOSPC0EIDRM0ENOBUFS0ENOSYS0EHOSTDOWN0EBA
+DFD0ENOSR0ENOTCONN0ESTALE0EDQUOT0EMFILE0EACCES0EBUSY0EPERM0E2BIG0ELIB
+EXEC0ETOOMANYREFS0ELIBACC0ENOTUNIQ0ECOMM0ERESTART0EUNATCH0ESOCKTNOSUP
+PORT0ETIMEDOUT0ENXIO0ETXTBSY0ENODEV0EMLINK0ECHILD0EHOSTUNREACH0EREMCH
+G0ENOTEMPTY0
Update:
lorien:~$ perl -v
This is perl, v5.8.0 built for i386-linux-thread-multi
Well its just for fun when i read in perlvar about %! and the last news about sendmail and bind it just comes to my head, ode to sendmail and bind here it is.
$anarion=\$anarion;
s==q^QBY_^=,$_^=$[x7,print
| [reply] [d/l] [select] |
|
[johnsca@CORY johnsca]$ perl -wle 'print %!'
[johnsca@CORY johnsca]$ perl -wle '*c=*!; print %c'
[johnsca@CORY johnsca]$ perl -wle 'use Errno; print %!'
ECOMMOEPIPE ...(etc)
[johnsca@CORY johnsca]$ perl -wle 'use Errno; *c=*!; print %c'
ECOMMOEPIPE ...(etc)
[johnsca@CORY johnsca]$ perl -v
This is perl, v5.6.1 built for cygwin-multi
...(etc)
And I get the same results for my ActiveState Perl 5.6.1.
bbfu
Black flowers blossum
Fearless on my breath | [reply] [d/l] |
|
| [reply] |
|
| [reply] |
Re: special magic in "%!" ?
by Hofmator (Curate) on Mar 08, 2003 at 15:46 UTC
|
The question is: What are you expecting it to print? If you are expecting a 'used only once' warning, these don't show up for all the special variables composed of only a special char, like %! or %^ or @# ...
-- Hofmator | [reply] |
|
I was expenting to print the same than:
print %!
$anarion=\$anarion;
s==q^QBY_^=,$_^=$[x7,print
| [reply] [d/l] |
|
Aha, which it doesn't do here. As was figured out in the meantime here in this thread this behaviour changed between perl 5.6 and 5.8. And as you can guess by now, I'm on 5.6 :) - therefore my question. I get the same results as bbfu below.
-- Hofmator
| [reply] |