Главная страница


ru.perl

 
 - RU.PERL ----------------------------------------------------------------------
 From : Yury Sukhovey                        2:452/50.66    07 May 2002  07:51:44
 To : Sergey Gernichenko
 Subject : Re: Можно ли узнать список определенных переменных?
 -------------------------------------------------------------------------------- 
 
 > Сабж.
 > Имеется процедурка, надо вывести на консоль список имён предопределенных
 > переменных. Возможно ли это?
 
 можно
 
 вот фрагмент из "Programming Perl":
 
 Since a package is a hash, you can look up the keys of the package and get
 to all the variables of the package. Since the values of the hash are
 typeglobs, you can dereference them in several ways. Try this:
 
 foreach $symname (sort keys %main::) {
     local *sym = $main::{$symname};
     print "\$$symname is defined\n" if defined $sym;
     print "\@$symname is nonnull\n" if         @sym;
     print "\%$symname is nonnull\n" if         %sym;
 }
 --- InterSquish NNTP Server/FTN Gate v.1.7.0.1
  * Origin: ... Crazy Computers Systems ... (2:452/50.66)
 
 

Вернуться к списку тем, сортированных по: возрастание даты  уменьшение даты  тема  автор 

 Тема:    Автор:    Дата:  
 Re: Можно ли узнать список определенных переменных?   Yury Sukhovey   07 May 2002 07:51:44 
Архивное /ru.perl/28043cd76b70.html, оценка 1 из 5, голосов 10
Яндекс.Метрика
Valid HTML 4.01 Transitional