Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikibooksThe Free Textbook Project
Search

Perl Programming/References and data structures

From Wikibooks, open books for an open world
<Perl Programming
Previous: Hash variablesIndexNext: User input-output

Introduction

[edit |edit source]

So you've been plodding along with your perl scripts, fiddling with arrays and hashes and suddenly you realize that you would like to pass a function to another function depending on the data you encounter, or perhaps you would like to get back a hash when you look up an array index. References are the thing for you, allowing you to build and pass around ever more complex data structures.

Referencing and dereferencing syntax

[edit |edit source]
my$nightmare="clowns";my$ref=\$nightmare;print"I laugh in the face of ".${$ref}."\n";

Output should beI laugh in the face of clowns.

The curly brackets are optional, but generally recommended.

External links

[edit |edit source]


Previous: Hash variablesIndexNext: User input-output
Retrieved from "https://en.wikibooks.org/w/index.php?title=Perl_Programming/References_and_data_structures&oldid=3677320"
Category:

[8]ページ先頭

©2009-2025 Movatter.jp