Perl Syntax

John Wildberger wildberger-iRg7kjdsKiH3fQ9qLvQP4Q at public.gmane.org
Tue May 24 20:12:21 UTC 2005


On Tuesday 24 May 2005 09:03 am, Taavi Burns wrote:
> On 5/24/05, Peter <plp-ysDPMY98cNQDDBjDh4tngg at public.gmane.org> wrote:
> > On Mon, 23 May 2005, John Vetterli wrote:
> > > So is the "INT" in $SIG{INT} a string literal (i.e. is it really
> > > $SIG{"INT"}) or a variable name?  Or is it something else?
> >
> > It stays for SIGINT which is a symbol name that is equivalent to the
> > code of the interrupt signal. In Perl it need not be a number (Perl uses
> > hashes - i.e. SIGINT is simply a key in a database of tuples).
>
> However, being a bareword (no sigil, not in the context of a file
> handle, and not a number) it's interpreted as a string and $SIG{INT}
> should be equivalent to $SIG{"INT"} and equivalent to $SIG{'INT'}.
A few words of clarification:
$SIG{INT} is a part of the %SIG hash. This is indicated by the use of the 
curly brackets. 
INT is the 'key' to the data base of %SIG.
SIGINT has no place in this context. $SIGINT would simply be a scalar 
variable.
%SIG has numerous items with misc keys.and their associated values.
This database is solely used to provide a means to communicate signals to 
processes. The key 'INT' associates the key with the value of the hash item. 
In this particular case it give reference to a subroutine that handles an 
Interrupt.  
John
--
The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml





More information about the Legacy mailing list