http://www.perlmonks.org?node_id=241406


in reply to special magic in "%!" ?

%! (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

Replies are listed 'Best First'.
Re: Re: special magic in "%!" ?
by converter (Priest) on Mar 08, 2003 at 22:01 UTC

    The reference to %! requires Errno.pmc, then if that fails, Errno.pm.

    Compare:

    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
      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
Re: Re: special magic in "%!" ?
by Anarion (Hermit) on Mar 08, 2003 at 21:33 UTC
    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

      My perl doesn't do that.

      [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

      Ok!

      My bleadperl does the same thing. I'm currently looking into it.
      This behaviour seems to have changed between 5.6 and 5.8.

      janx

      Exactly the same for me on Darwin.

      Anarion could you provide the complete script?
      Maybe we can work that one out.

      janx