O'Reilly logo

Programmieren mit Perl by Jon Orwant, Tom Christiansen, Larry Wall

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Symbol

use Symbol "delete_package";
delete_package("Foo::Bar");
print "gelöscht\n" unless exists $Foo::{"Bar::"};

use Symbol "gensym";
$syml = getsym();      # Gibt neuen anonymen Typeglob zurück.
$sym2 = getsym();      # Ein weiterer neuer anonymer Typeglob.

package Demo;
use Symbol "qualify";
$sym = qualify("x");              # "Demo::x"
$sym = qualifyC'x", "Foo");       # "Foo::x"
$sym = qualify("Bar::x");         # "Bar::x"
$sym = qualifyC'Bar::x", "Foo");  # "Bar::x"

use Symbol "qualify_to_ref";
sub pass_handle(*) {
    my $fh = qualify_to_ref(shift, caller);
    ...
}
# Jetzt können Sie pass_handle mit FH, "FH", *FH oder \*FH aufrufen.

Das Symbol-Modul stellt Funktionen bereit, mit deren Hilfe globale Namen manipuliert werden können: Typeglobs, Formatnamen, Dateihandles, Paket-Symboltabellen ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required