PERL
Special Variables
The following variables are global and should be localized in subroutines:
$_ The default input and pattern-searching space.
$. The current input line number of the last filehandle that was read.
$/ The input record separator, newline by default. May be multicharacter.
$, The output field separator for the print operator.
$” The separator that joins elements of arrays interpolated in strings.
$\ The output record separator for the print operator.
$# The output format for printed numbers.
$* Set to 1 to do multiline matching within strings.
see the m and s modifiers in Search and Replace Functions.
$? The status returned by the last `…` command,
pipe close or system operator. ($CHILD_ERROR) Status-Nummer from last System calls
$] The perl version number, e.g., 5.001. Version des Perl-Interpreters (z.B. 5.003)
$[ The index of the first element in an array, and of the first character in a substring. Default is 0.
$; The subscript separator for multidimensional array emulation. Default is “\034”.
$! If used in a numeric context, yields the current value of errno.
If used in a string context, yields the corresponding error string.
($OS_ERROR,$ERRNO) Fehlerummer oder -meldung (je nach Kontext) from last system calls
$@ The Perl error message from the last eval or do EXPR command.
error message from last eval()-Aufrufs Variables, die nicht mehr verwendet werden sollten
$: The set of characters after which a string may be broken to fill continuation fields (starting with ^) in a format.
list of characters, an deren Stelle in einem String dieser getrennt werden darf.
(zur Aufsplittung bei Ausgabe von längeren Texten über mehrere Zeilen)
$0 The name of the file containing the Perl script being executed.
May be assigned to. Name des gerade laufenden Programms.
$$ The process ID of the currently executing Perl program.
Altered (in the child process) by fork. Prozeß-Nummer von Perl
$< The real user ID of this process. ($REAL_USER_ID,$UID) Benutzer-ID,
unter der der Prozeß gestartet wurde $> The effective user ID of this process. Benutzer-ID, unter der der Prozeß aktuell läuft (verschieden von $< im Falle von “Setuid”-Programmen)
$( The real group ID of this process. ($REAL_GROUP_ID,$GID) Liste der Gruppen des Benutzers, unter dem der Prozeß gestartet wurde $) The effective group ID of this process. ($EFFECTIVE_GROUP_ID,$EGID) aktuelle Liste der Gruppen des Benutzers (verschieden von $( im Falle von “Setgid”-Programmen
$^A The accumulator for formline and write operations.
$^D The debug flags as passed to perl using -D.
$^F The highest system file descriptor, ordinarily 2.
$^I In-place edit extension as passed to Perl using -i.
$^L Formfeed character used in formats. Zeichenkette,
die vor jedem Seitenkopf ausgegeben wird (z.B. Seitenvorschub auf einem Drucker).
$^P Internal debugging flag.
$^T The time (as delivered by time) when the program started.
This value is used by the file test operators -M, -A and -C.
Zeitpunkt, an dem das aktuelle Skript gestartet wurde (unter UNIX: Anzahl der Sekunden
$^W The value if the -w option as passed to Perl.
Zeigt an, ob Warnungen ausgegeben werden sollen (z.B. durch die Option “-w”).
$^X The name by which the currently executing program was invoked. Name des Perl-Interpreters
The following variables are context dependent and need not beocalized:
$% The current page number of the currently selected output channel.
$= The page length of the current output channel. Default is 60 lines. Anzahl der Zeilen pro Seite
$- The number of lines remaining on the page. Anzahl der restlichen Zeilen auf der aktuellen Seite
$~ The name of the current report format.
$^ The name of the current top-of-page format.
$| If set to nonzero, forces a flush after every write or print on the currently selected output channel. Default is 0.
$ARGV The name of the current file when reading from <>.
The following variables are always local to the current block:
$& The string matched by the last successful pattern match.
$` The string preceding what was matched by the last successful match.
$’ The string following what was matched by the last successful match.
$+ The last bracket matched by the last search pattern.
$1…$9… Contain the subpatterns from the corresponding sets of parentheses in the last pattern successfully matched. $10…
and up are only available if the match contained that many subpatterns.
Leave a Reply