Debian Codegraph @

po/ro/man1/perlref.1.po

raw
1 # Romanian translation of manpages
2 # This file is distributed under the same license as the manpages-l10n package.
3 # Copyright © of this file:
4 # Remus-Gabriel Chelu <[email protected]>, 2026.
5 msgid ""
6 msgstr ""
7 "Project-Id-Version: manpages-l10n 4.30.2\n"
8 "POT-Creation-Date: 2026-06-05 06:34+0200\n"
9 "PO-Revision-Date: 2026-06-02 09:04+0200\n"
10 "Last-Translator: Remus-Gabriel Chelu <[email protected]>\n"
11 "Language-Team: Romanian <[email protected]>\n"
12 "Language: ro\n"
13 "MIME-Version: 1.0\n"
14 "Content-Type: text/plain; charset=UTF-8\n"
15 "Content-Transfer-Encoding: 8bit\n"
16 "Plural-Forms: nplurals=3; plural=n==1 ? 0 : (n==0 || (n%100 > 0 && n%100 < "
17 "20)) ? 1 : 2;\n"
18 "X-Generator: Poedit 3.8\n"
19
20 # #-#-#-#-# fedora-44: perlref.1.pot (PACKAGE VERSION) #-#-#-#-#
21 #
22 # #-#-#-#-# fedora-rawhide: perlref.1.pot (PACKAGE VERSION) #-#-#-#-#
23 #
24 # #-#-#-#-# mageia-cauldron: perlref.1.pot (PACKAGE VERSION) #-#-#-#-#
25 #
26 # #-#-#-#-# opensuse-leap-16-1: perlref.1.pot (PACKAGE VERSION) #-#-#-#-#
27 #
28 # #-#-#-#-# opensuse-tumbleweed: perlref.1.pot (PACKAGE VERSION) #-#-#-#-#
29 #
30 #. #-#-#-#-# debian-trixie: perlref.1.pot (PACKAGE VERSION) #-#-#-#-#
31 #. ========================================================================
32 #. type: IX
33 #. #-#-#-#-# debian-unstable: perlref.1.pot (PACKAGE VERSION) #-#-#-#-#
34 #. ========================================================================
35 #. type: IX
36 #. #-#-#-#-# fedora-44: perlref.1.pot (PACKAGE VERSION) #-#-#-#-#
37 #. Required to disable full justification in groff 1.23.0.
38 #. ========================================================================
39 #. type: IX
40 #. #-#-#-#-# fedora-rawhide: perlref.1.pot (PACKAGE VERSION) #-#-#-#-#
41 #. Required to disable full justification in groff 1.23.0.
42 #. ========================================================================
43 #. type: IX
44 #. #-#-#-#-# mageia-cauldron: perlref.1.pot (PACKAGE VERSION) #-#-#-#-#
45 #. Required to disable full justification in groff 1.23.0.
46 #. ========================================================================
47 #. type: IX
48 #. #-#-#-#-# opensuse-leap-16-1: perlref.1.pot (PACKAGE VERSION) #-#-#-#-#
49 #. Required to disable full justification in groff 1.23.0.
50 #. ========================================================================
51 #. type: IX
52 #. #-#-#-#-# opensuse-tumbleweed: perlref.1.pot (PACKAGE VERSION) #-#-#-#-#
53 #. Required to disable full justification in groff 1.23.0.
54 #. ========================================================================
55 #. type: IX
56 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
57 #: opensuse-leap-16-1 opensuse-tumbleweed
58 #, no-wrap
59 msgid "Title"
60 msgstr "Titlu"
61
62 # #-#-#-#-# fedora-44: perlref.1.pot (PACKAGE VERSION) #-#-#-#-#
63 #
64 # #-#-#-#-# fedora-rawhide: perlref.1.pot (PACKAGE VERSION) #-#-#-#-#
65 #
66 # #-#-#-#-# mageia-cauldron: perlref.1.pot (PACKAGE VERSION) #-#-#-#-#
67 #
68 # #-#-#-#-# opensuse-leap-16-1: perlref.1.pot (PACKAGE VERSION) #-#-#-#-#
69 #
70 # #-#-#-#-# opensuse-tumbleweed: perlref.1.pot (PACKAGE VERSION) #-#-#-#-#
71 #
72 #. #-#-#-#-# debian-trixie: perlref.1.pot (PACKAGE VERSION) #-#-#-#-#
73 #. ========================================================================
74 #. type: IX
75 #. #-#-#-#-# debian-unstable: perlref.1.pot (PACKAGE VERSION) #-#-#-#-#
76 #. ========================================================================
77 #. type: IX
78 #. #-#-#-#-# fedora-44: perlref.1.pot (PACKAGE VERSION) #-#-#-#-#
79 #. Required to disable full justification in groff 1.23.0.
80 #. ========================================================================
81 #. type: IX
82 #. #-#-#-#-# fedora-rawhide: perlref.1.pot (PACKAGE VERSION) #-#-#-#-#
83 #. Required to disable full justification in groff 1.23.0.
84 #. ========================================================================
85 #. type: IX
86 #. #-#-#-#-# mageia-cauldron: perlref.1.pot (PACKAGE VERSION) #-#-#-#-#
87 #. Required to disable full justification in groff 1.23.0.
88 #. ========================================================================
89 #. type: IX
90 #. #-#-#-#-# opensuse-leap-16-1: perlref.1.pot (PACKAGE VERSION) #-#-#-#-#
91 #. Required to disable full justification in groff 1.23.0.
92 #. ========================================================================
93 #. type: IX
94 #. #-#-#-#-# opensuse-tumbleweed: perlref.1.pot (PACKAGE VERSION) #-#-#-#-#
95 #. Required to disable full justification in groff 1.23.0.
96 #. ========================================================================
97 #. type: IX
98 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
99 #: opensuse-leap-16-1 opensuse-tumbleweed
100 #, no-wrap
101 msgid "PERLREF 1"
102 msgstr "PERLREF 1"
103
104 #. type: TH
105 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
106 #: opensuse-leap-16-1 opensuse-tumbleweed
107 #, no-wrap
108 msgid "PERLREF"
109 msgstr "PERLREF"
110
111 #. type: TH
112 #: debian-trixie
113 #, no-wrap
114 msgid "2025-07-27"
115 msgstr "27 iulie 2025"
116
117 #. type: TH
118 #: debian-trixie debian-unstable
119 #, no-wrap
120 msgid "perl v5.40.1"
121 msgstr "perl v5.40.1"
122
123 #. type: TH
124 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
125 #: opensuse-leap-16-1 opensuse-tumbleweed
126 #, no-wrap
127 msgid "Perl Programmers Reference Guide"
128 msgstr "Ghid de referință pentru programatorii Perl"
129
130 #. type: SH
131 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
132 #: opensuse-leap-16-1 opensuse-tumbleweed
133 #, no-wrap
134 msgid "NAME"
135 msgstr "NUME"
136
137 #. type: Plain text
138 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
139 #: opensuse-leap-16-1 opensuse-tumbleweed
140 msgid "perlref - Perl references and nested data structures"
141 msgstr "perlref - referințe Perl și structuri de date imbricate"
142
143 #. type: IX
144 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
145 #: opensuse-leap-16-1 opensuse-tumbleweed
146 #, no-wrap
147 msgid "Xref"
148 msgstr "Xref"
149
150 #. type: IX
151 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
152 #: opensuse-leap-16-1 opensuse-tumbleweed
153 #, no-wrap
154 msgid "reference pointer data structure structure struct"
155 msgstr ""
156
157 #. type: IX
158 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
159 #: opensuse-leap-16-1 opensuse-tumbleweed
160 #, no-wrap
161 msgid "NOTE"
162 msgstr "NOTĂ"
163
164 #. type: IX
165 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
166 #: opensuse-leap-16-1 opensuse-tumbleweed
167 #, no-wrap
168 msgid "Header"
169 msgstr "Antet"
170
171 #. type: Plain text
172 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
173 #: opensuse-leap-16-1 opensuse-tumbleweed
174 msgid ""
175 "This is complete documentation about all aspects of references. For a "
176 "shorter, tutorial introduction to just the essential features, see "
177 "perlreftut."
178 msgstr ""
179 "Aceasta este documentația completă privind toate aspectele legate de "
180 "referințe. Pentru o introducere mai succintă, sub formă de tutorial, care se "
181 "concentrează doar pe caracteristicile esențiale, consultați perlreftut."
182
183 #. type: IX
184 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
185 #: opensuse-leap-16-1 opensuse-tumbleweed
186 #, no-wrap
187 msgid "DESCRIPTION"
188 msgstr "DESCRIERE"
189
190 #. type: Plain text
191 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
192 #: opensuse-leap-16-1 opensuse-tumbleweed
193 msgid ""
194 "Before release 5 of Perl it was difficult to represent complex data "
195 "structures, because all references had to be symbolic--and even then it was "
196 "difficult to refer to a variable instead of a symbol table entry. Perl now "
197 "not only makes it easier to use symbolic references to variables, but also "
198 "lets you have \"hard\" references to any piece of data or code. Any scalar "
199 "may hold a hard reference. Because arrays and hashes contain scalars, you "
200 "can now easily build arrays of arrays, arrays of hashes, hashes of arrays, "
201 "arrays of hashes of functions, and so on."
202 msgstr ""
203
204 #. type: Plain text
205 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
206 #: opensuse-leap-16-1 opensuse-tumbleweed
207 msgid ""
208 "Hard references are smart--they keep track of reference counts for you, "
209 "automatically freeing the thing referred to when its reference count goes to "
210 "zero. (Reference counts for values in self-referential or cyclic data "
211 "structures may not go to zero without a little help; see \"Circular "
212 "References\" for a detailed explanation.) If that thing happens to be an "
213 "object, the object is destructed. See perlobj for more about objects. (In "
214 "a sense, everything in Perl is an object, but we usually reserve the word "
215 "for references to objects that have been officially \"blessed\" into a class "
216 "package.)"
217 msgstr ""
218
219 #. type: Plain text
220 #: debian-trixie debian-unstable
221 msgid ""
222 "Symbolic references are names of variables or other objects, just as a "
223 "symbolic link in a Unix filesystem contains merely the name of a file. The "
224 "CW<*glob> notation is something of a symbolic reference. (Symbolic "
225 "references are sometimes called \"soft references\", but please don't call "
226 "them that; references are confusing enough without useless synonyms.)"
227 msgstr ""
228
229 #. type: IX
230 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
231 #: opensuse-leap-16-1 opensuse-tumbleweed
232 #, no-wrap
233 msgid "reference, symbolic reference, soft symbolic reference soft reference"
234 msgstr ""
235
236 #. type: Plain text
237 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
238 #: opensuse-leap-16-1 opensuse-tumbleweed
239 msgid ""
240 "In contrast, hard references are more like hard links in a Unix file system: "
241 "They are used to access an underlying object without concern for what its "
242 "(other) name is. When the word \"reference\" is used without an adjective, "
243 "as in the following paragraph, it is usually talking about a hard reference."
244 msgstr ""
245
246 #. type: IX
247 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
248 #: opensuse-leap-16-1 opensuse-tumbleweed
249 #, no-wrap
250 msgid "reference, hard hard reference"
251 msgstr ""
252
253 #. type: Plain text
254 #: debian-trixie debian-unstable
255 msgid ""
256 "References are easy to use in Perl. There is just one overriding principle: "
257 "in general, Perl does no implicit referencing or dereferencing. When a "
258 "scalar is holding a reference, it always behaves as a simple scalar. It "
259 "doesn't magically start being an array or hash or subroutine; you have to "
260 "tell it explicitly to do so, by dereferencing it."
261 msgstr ""
262
263 #. type: IX
264 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
265 #: opensuse-leap-16-1 opensuse-tumbleweed
266 #, no-wrap
267 msgid "Making References"
268 msgstr "Crearea referințelor"
269
270 #. type: IX
271 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
272 #: opensuse-leap-16-1 opensuse-tumbleweed
273 #, no-wrap
274 msgid "reference, creation referencing"
275 msgstr ""
276
277 #. type: IX
278 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
279 #: opensuse-leap-16-1 opensuse-tumbleweed
280 #, no-wrap
281 msgid "Subsection"
282 msgstr "Subsecțiune"
283
284 #. type: Plain text
285 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
286 #: opensuse-leap-16-1 opensuse-tumbleweed
287 msgid "References can be created in several ways."
288 msgstr "Referințele pot fi create în mai multe moduri."
289
290 #. type: Plain text
291 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
292 #: opensuse-leap-16-1 opensuse-tumbleweed
293 msgid "I<Backslash Operator>"
294 msgstr "I<Operatorul bară oblică inversă>"
295
296 #. type: IX
297 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
298 #: opensuse-leap-16-1 opensuse-tumbleweed
299 #, no-wrap
300 msgid "\\ backslash"
301 msgstr "\\ bară oblică inversă"
302
303 #. type: IX
304 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
305 #: opensuse-leap-16-1 opensuse-tumbleweed
306 #, no-wrap
307 msgid "Backslash Operator"
308 msgstr "Operatorul bară oblică inversă"
309
310 #. type: Plain text
311 #: debian-trixie debian-unstable
312 msgid ""
313 "By using the backslash operator on a variable, subroutine, or value. (This "
314 "works much like the & (address-of) operator in C.) This typically creates "
315 "I<another> reference to a variable, because there's already a reference to "
316 "the variable in the symbol table. But the symbol table reference might go "
317 "away, and you'll still have the reference that the backslash returned. Here "
318 "are some examples:"
319 msgstr ""
320
321 #. type: Plain text
322 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
323 #: opensuse-leap-16-1 opensuse-tumbleweed
324 #, no-wrap
325 msgid ""
326 "\\& $scalarref = \\e$foo;\n"
327 "\\& $arrayref = \\e@ARGV;\n"
328 "\\& $hashref = \\e%ENV;\n"
329 "\\& $coderef = \\e&handler;\n"
330 "\\& $globref = \\e*foo;\n"
331 msgstr ""
332 "\\& $scalarref = \\e$foo;\n"
333 "\\& $arrayref = \\e@ARGV;\n"
334 "\\& $hashref = \\e%ENV;\n"
335 "\\& $coderef = \\e&handler;\n"
336 "\\& $globref = \\e*foo;\n"
337
338 #. type: Plain text
339 #: debian-trixie debian-unstable
340 msgid ""
341 "It isn't possible to create a true reference to an IO handle (filehandle or "
342 "dirhandle) using the backslash operator. The most you can get is a "
343 "reference to a typeglob, which is actually a complete symbol table entry. "
344 "But see the explanation of the CW<*foo{THING}> syntax below. However, you "
345 "can still use type globs and globrefs as though they were IO handles."
346 msgstr ""
347
348 #. type: Plain text
349 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
350 #: opensuse-leap-16-1 opensuse-tumbleweed
351 msgid "I<Square Brackets>"
352 msgstr "I<Paranteze drepte>"
353
354 #. type: IX
355 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
356 #: opensuse-leap-16-1 opensuse-tumbleweed
357 #, no-wrap
358 msgid "array, anonymous [ [] square bracket bracket, square arrayref array reference reference, array"
359 msgstr ""
360
361 #. type: IX
362 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
363 #: opensuse-leap-16-1 opensuse-tumbleweed
364 #, no-wrap
365 msgid "Square Brackets"
366 msgstr "Paranteze drepte"
367
368 #. type: Plain text
369 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
370 #: opensuse-leap-16-1 opensuse-tumbleweed
371 msgid "A reference to an anonymous array can be created using square brackets:"
372 msgstr ""
373 "O referință la o matrice anonimă poate fi creată folosind paranteze pătrate:"
374
375 #. type: Plain text
376 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
377 #: opensuse-leap-16-1 opensuse-tumbleweed
378 #, no-wrap
379 msgid "\\& $arrayref = [1, 2, [\\*(Aqa\\*(Aq, \\*(Aqb\\*(Aq, \\*(Aqc\\*(Aq]];\n"
380 msgstr "\\& $arrayref = [1, 2, [\\*(Aqa\\*(Aq, \\*(Aqb\\*(Aq, \\*(Aqc\\*(Aq]];\n"
381
382 #. type: Plain text
383 #: debian-trixie debian-unstable
384 msgid ""
385 "Here we've created a reference to an anonymous array of three elements whose "
386 "final element is itself a reference to another anonymous array of three "
387 "elements. (The multidimensional syntax described later can be used to "
388 "access this. For example, after the above, CW<\\*(C`$arrayref-E<gt>[2]"
389 "[1]\\*(C'> would have the value \"b\".)"
390 msgstr ""
391
392 #. type: Plain text
393 #: debian-trixie debian-unstable
394 msgid ""
395 "Taking a reference to an enumerated list is not the same as using square "
396 "brackets--instead it's the same as creating a list of references!"
397 msgstr ""
398 "Luarea unei referințe la o listă enumerată nu este același lucru cu "
399 "utilizarea parantezelor drepte - ci echivalează cu crearea unei liste de "
400 "referințe!"
401
402 #. type: Plain text
403 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
404 #: opensuse-leap-16-1 opensuse-tumbleweed
405 #, no-wrap
406 msgid ""
407 "\\& @list = (\\e$x, \\e@y, \\e%z);\n"
408 "\\& @list = \\e($x, @y, %z); # same thing!\n"
409 msgstr ""
410 "\\& @list = (\\e$x, \\e@y, \\e%z);\n"
411 "\\& @list = \\e($x, @y, %z); # e același lucru!\n"
412
413 #. type: Plain text
414 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
415 #: opensuse-leap-16-1 opensuse-tumbleweed
416 msgid ""
417 "As a special case, CW<\\*(C`\\e(@foo)\\*(C'> returns a list of references to "
418 "the contents of CW<@foo>, not a reference to CW<@foo> itself. Likewise for "
419 "CW<%foo>, except that the key references are to copies (since the keys are "
420 "just strings rather than full-fledged scalars)."
421 msgstr ""
422
423 #. type: Plain text
424 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
425 #: opensuse-leap-16-1 opensuse-tumbleweed
426 msgid "I<Curly Brackets>"
427 msgstr "I<Acolade>"
428
429 #. type: IX
430 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
431 #: opensuse-leap-16-1 opensuse-tumbleweed
432 #, no-wrap
433 msgid "hash, anonymous { {} curly bracket bracket, curly brace hashref hash reference reference, hash"
434 msgstr ""
435
436 #. type: IX
437 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
438 #: opensuse-leap-16-1 opensuse-tumbleweed
439 #, no-wrap
440 msgid "Curly Brackets"
441 msgstr "Acolade"
442
443 #. type: Plain text
444 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
445 #: opensuse-leap-16-1 opensuse-tumbleweed
446 msgid "A reference to an anonymous hash can be created using curly brackets:"
447 msgstr "O referință la un hash anonim poate fi creată folosind acolade:"
448
449 #. type: Plain text
450 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
451 #: opensuse-leap-16-1 opensuse-tumbleweed
452 #, no-wrap
453 msgid ""
454 "\\& $hashref = {\n"
455 "\\& \\*(AqAdam\\*(Aq =E<gt> \\*(AqEve\\*(Aq,\n"
456 "\\& \\*(AqClyde\\*(Aq =E<gt> \\*(AqBonnie\\*(Aq,\n"
457 "\\& };\n"
458 msgstr ""
459 "\\& $hashref = {\n"
460 "\\& \\*(AqAdam\\*(Aq =E<gt> \\*(AqEve\\*(Aq,\n"
461 "\\& \\*(AqClyde\\*(Aq =E<gt> \\*(AqBonnie\\*(Aq,\n"
462 "\\& };\n"
463
464 #. type: Plain text
465 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
466 #: opensuse-leap-16-1 opensuse-tumbleweed
467 msgid ""
468 "Anonymous hash and array composers like these can be intermixed freely to "
469 "produce as complicated a structure as you want. The multidimensional syntax "
470 "described below works for these too. The values above are literals, but "
471 "variables and expressions would work just as well, because assignment "
472 "operators in Perl (even within B<local()> or B<my()>) are executable "
473 "statements, not compile-time declarations."
474 msgstr ""
475
476 #. type: Plain text
477 #: debian-trixie debian-unstable
478 msgid ""
479 "Because curly brackets (braces) are used for several other things including "
480 "BLOCKs, you may occasionally have to disambiguate braces at the beginning of "
481 "a statement by putting a CW<\\*(C`+\\*(C'> or a CW<\\*(C`return\\*(C'> in "
482 "front so that Perl realizes the opening brace isn't starting a BLOCK. The "
483 "economy and mnemonic value of using curlies is deemed worth this occasional "
484 "extra hassle."
485 msgstr ""
486
487 #. type: Plain text
488 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
489 #: opensuse-leap-16-1 opensuse-tumbleweed
490 msgid ""
491 "For example, if you wanted a function to make a new hash and return a "
492 "reference to it, you have these options:"
493 msgstr ""
494 "De exemplu, dacă doriți ca o funcție să creeze un nou hash și să returneze o "
495 "referință la acesta, aveți următoarele opțiuni:"
496
497 #. type: Plain text
498 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
499 #: opensuse-leap-16-1 opensuse-tumbleweed
500 #, no-wrap
501 msgid ""
502 "\\& sub hashem { { @_ } } # silently wrong\n"
503 "\\& sub hashem { +{ @_ } } # ok\n"
504 "\\& sub hashem { return { @_ } } # ok\n"
505 msgstr ""
506 "\\& sub hashem { { @_ } } # greșește în tăcere\n"
507 "\\& sub hashem { +{ @_ } } # ok\n"
508 "\\& sub hashem { return { @_ } } # ok\n"
509
510 #. type: Plain text
511 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
512 #: opensuse-leap-16-1 opensuse-tumbleweed
513 msgid "On the other hand, if you want the other meaning, you can do this:"
514 msgstr ""
515 "Pe de altă parte, dacă vrei să folosești celălalt sens, poți proceda astfel:"
516
517 #. type: Plain text
518 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
519 #: opensuse-leap-16-1 opensuse-tumbleweed
520 #, no-wrap
521 msgid ""
522 "\\& sub showem { { @_ } } # ambiguous (currently ok,\n"
523 "\\& # but may change)\n"
524 "\\& sub showem { {; @_ } } # ok\n"
525 "\\& sub showem { { return @_ } } # ok\n"
526 msgstr ""
527 "\\& sub showem { { @_ } } # ambiguu (în prezent este ok,\n"
528 "\\& # dar s-ar putea schimba)\n"
529 "\\& sub showem { {; @_ } } # ok\n"
530 "\\& sub showem { { return @_ } } # ok\n"
531
532 #. type: Plain text
533 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
534 #: opensuse-leap-16-1 opensuse-tumbleweed
535 msgid ""
536 "The leading CW<\\*(C`+{\\*(C'> and CW<\\*(C`{;\\*(C'> always serve to "
537 "disambiguate the expression to mean either the HASH reference, or the BLOCK."
538 msgstr ""
539
540 #. type: Plain text
541 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
542 #: opensuse-leap-16-1 opensuse-tumbleweed
543 msgid "I<Anonymous Subroutines>"
544 msgstr "I<Subrutine anonime>"
545
546 #. type: IX
547 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
548 #: opensuse-leap-16-1 opensuse-tumbleweed
549 #, no-wrap
550 msgid "subroutine, anonymous subroutine, reference reference, subroutine scope, lexical closure lexical lexical scope"
551 msgstr ""
552
553 #. type: IX
554 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
555 #: opensuse-leap-16-1 opensuse-tumbleweed
556 #, no-wrap
557 msgid "Anonymous Subroutines"
558 msgstr "Subrutine anonime"
559
560 #. type: Plain text
561 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
562 #: opensuse-leap-16-1 opensuse-tumbleweed
563 msgid ""
564 "A reference to an anonymous subroutine can be created by using "
565 "\\&CW<\\*(C`sub\\*(C'> without a subname:"
566 msgstr ""
567 "O referință la o subrutină anonimă poate fi creată folosind „sub” fără un "
568 "nume de subrutină:"
569
570 #. type: Plain text
571 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
572 #: opensuse-leap-16-1 opensuse-tumbleweed
573 #, no-wrap
574 msgid "\\& $coderef = sub { print \"Boink!\\en\" };\n"
575 msgstr "\\& $coderef = sub { print \"Bum!\\en\" };\n"
576
577 #. type: Plain text
578 #: debian-trixie debian-unstable
579 msgid ""
580 "Note the semicolon. Except for the code inside not being immediately "
581 "executed, a CW<\\*(C`sub {}\\*(C'> is not so much a declaration as it is an "
582 "operator, like CW<\\*(C`do{}\\*(C'> or CW<\\*(C`eval{}\\*(C'>. (However, no "
583 "matter how many times you execute that particular line (unless you're in an "
584 "\\&CW<eval(\"...\")>), CW<$coderef> will still have a reference to the "
585 "I<same> anonymous subroutine.)"
586 msgstr ""
587
588 #. type: Plain text
589 #: debian-trixie debian-unstable
590 msgid ""
591 "Anonymous subroutines act as closures with respect to B<my()> variables, "
592 "that is, variables lexically visible within the current scope. Closure is a "
593 "notion out of the Lisp world that says if you define an anonymous function "
594 "in a particular lexical context, it pretends to run in that context even "
595 "when it's called outside the context."
596 msgstr ""
597
598 #. type: Plain text
599 #: debian-trixie debian-unstable
600 msgid ""
601 "In human terms, it's a funny way of passing arguments to a subroutine when "
602 "you define it as well as when you call it. It's useful for setting up "
603 "little bits of code to run later, such as callbacks. You can even do object-"
604 "oriented stuff with it, though Perl already provides a different mechanism "
605 "to do that--see perlobj."
606 msgstr ""
607
608 #. type: Plain text
609 #: debian-trixie debian-unstable
610 msgid ""
611 "You might also think of closure as a way to write a subroutine template "
612 "without using B<eval()>. Here's a small example of how closures work:"
613 msgstr ""
614 "Ați putea considera, de asemenea, că o închidere este o modalitate de a "
615 "scrie un șablon de subrutină fără a folosi B<eval()>. Iată un mic exemplu "
616 "care ilustrează modul în care funcționează închiderile:"
617
618 #. type: Plain text
619 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
620 #: opensuse-leap-16-1 opensuse-tumbleweed
621 #, no-wrap
622 msgid ""
623 "\\& sub newprint {\n"
624 "\\& my $x = shift;\n"
625 "\\& return sub { my $y = shift; print \"$x, $y!\\en\"; };\n"
626 "\\& }\n"
627 "\\& $h = newprint(\"Howdy\");\n"
628 "\\& $g = newprint(\"Greetings\");\n"
629 "\\&\n"
630 "\\& # Time passes...\n"
631 "\\&\n"
632 "\\& &$h(\"world\");\n"
633 "\\& &$g(\"earthlings\");\n"
634 msgstr ""
635 "\\& sub newprint {\n"
636 "\\& my $x = shift;\n"
637 "\\& return sub { my $y = shift; print \"$x, $y!\\en\"; };\n"
638 "\\& }\n"
639 "\\& $h = newprint(\"Salutare\");\n"
640 "\\& $g = newprint(\"Salutări\");\n"
641 "\\&\n"
642 "\\& # Timpul trece...\n"
643 "\\&\n"
644 "\\& &$h(\"lume\");\n"
645 "\\& &$g(\"pământeni\");\n"
646
647 #. type: Plain text
648 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
649 #: opensuse-leap-16-1 opensuse-tumbleweed
650 msgid "This prints"
651 msgstr "Aceasta afișează"
652
653 #. type: Plain text
654 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
655 #: opensuse-leap-16-1 opensuse-tumbleweed
656 #, no-wrap
657 msgid ""
658 "\\& Howdy, world!\n"
659 "\\& Greetings, earthlings!\n"
660 msgstr ""
661 "\\& Salutare lume!\n"
662 "\\& Salutări, pământeni!\n"
663
664 #. type: Plain text
665 #: debian-trixie debian-unstable
666 msgid ""
667 "Note particularly that CW<$x> continues to refer to the value passed into "
668 "B<newprint()> I<despite> \"my CW<$x>\" having gone out of scope by the time "
669 "the anonymous subroutine runs. That's what a closure is all about."
670 msgstr ""
671
672 #. type: Plain text
673 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
674 #: opensuse-leap-16-1 opensuse-tumbleweed
675 msgid ""
676 "This applies only to lexical variables, by the way. Dynamic variables "
677 "continue to work as they have always worked. Closure is not something that "
678 "most Perl programmers need trouble themselves about to begin with."
679 msgstr ""
680
681 #. type: Plain text
682 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
683 #: opensuse-leap-16-1 opensuse-tumbleweed
684 msgid "I<Constructors>"
685 msgstr "I<Constructori>"
686
687 #. type: IX
688 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
689 #: opensuse-leap-16-1 opensuse-tumbleweed
690 #, no-wrap
691 msgid "constructor new"
692 msgstr ""
693
694 #. type: IX
695 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
696 #: opensuse-leap-16-1 opensuse-tumbleweed
697 #, no-wrap
698 msgid "Constructors"
699 msgstr "Constructori"
700
701 #. type: Plain text
702 #: debian-trixie debian-unstable
703 msgid ""
704 "References are often returned by special subroutines called constructors. "
705 "Perl objects are just references to a special type of object that happens to "
706 "know which package it's associated with. Constructors are just special "
707 "subroutines that know how to create that association. They do so by "
708 "starting with an ordinary reference, and it remains an ordinary reference "
709 "even while it's also being an object. Constructors are often named "
710 "CW<new()>. You I<can> call them indirectly:"
711 msgstr ""
712
713 #. type: Plain text
714 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
715 #: opensuse-leap-16-1 opensuse-tumbleweed
716 #, no-wrap
717 msgid "\\& $objref = new Doggie( Tail =E<gt> \\*(Aqshort\\*(Aq, Ears =E<gt> \\*(Aqlong\\*(Aq );\n"
718 msgstr "\\& $objref = new Doggie( Tail =E<gt> \\*(Aqshort\\*(Aq, Ears =E<gt> \\*(Aqlong\\*(Aq );\n"
719
720 #. type: Plain text
721 #: debian-trixie debian-unstable
722 msgid ""
723 "But that can produce ambiguous syntax in certain cases, so it's often better "
724 "to use the direct method invocation approach:"
725 msgstr ""
726 "Dar aceasta poate produce o sintaxă ambiguă în anumite cazuri, așa că de "
727 "multe ori este mai bine să se utilizeze metoda invocării directe a metodei:"
728
729 #. type: Plain text
730 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
731 #: opensuse-leap-16-1 opensuse-tumbleweed
732 #, no-wrap
733 msgid ""
734 "\\& $objref = Doggie-E<gt>new(Tail =E<gt> \\*(Aqshort\\*(Aq, Ears =E<gt> \\*(Aqlong\\*(Aq);\n"
735 "\\&\n"
736 "\\& use Term::Cap;\n"
737 "\\& $terminal = Term::Cap-E<gt>Tgetent( { OSPEED =E<gt> 9600 });\n"
738 "\\&\n"
739 "\\& use Tk;\n"
740 "\\& $main = MainWindow-E<gt>new();\n"
741 "\\& $menubar = $main-E<gt>Frame(-relief =E<gt> \"raised\",\n"
742 "\\& -borderwidth =E<gt> 2)\n"
743 msgstr ""
744 "\\& $objref = Doggie-E<gt>new(Tail =E<gt> \\*(Aqshort\\*(Aq, Ears =E<gt> \\*(Aqlong\\*(Aq);\n"
745 "\\&\n"
746 "\\& use Term::Cap;\n"
747 "\\& $terminal = Term::Cap-E<gt>Tgetent( { OSPEED =E<gt> 9600 });\n"
748 "\\&\n"
749 "\\& use Tk;\n"
750 "\\& $main = MainWindow-E<gt>new();\n"
751 "\\& $menubar = $main-E<gt>Frame(-relief =E<gt> \"raised\",\n"
752 "\\& -borderwidth =E<gt> 2)\n"
753
754 #. type: Plain text
755 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
756 #: opensuse-leap-16-1 opensuse-tumbleweed
757 msgid ""
758 "This indirect object syntax is only available when \\&CW<\\*(C`use feature "
759 "\"indirect\"\\*(C'> is in effect, and that is not the case when CW<\\*(C`use "
760 "v5.36\\*(C'> (or higher) is requested, it is best to avoid indirect object "
761 "syntax entirely."
762 msgstr ""
763
764 #. type: Plain text
765 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
766 #: opensuse-leap-16-1 opensuse-tumbleweed
767 msgid "I<Autovivification>"
768 msgstr "I<Auto-vivificare>"
769
770 #. type: IX
771 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
772 #: opensuse-leap-16-1 opensuse-tumbleweed
773 #, no-wrap
774 msgid "autovivification"
775 msgstr "auto-vivificare"
776
777 #. type: IX
778 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
779 #: opensuse-leap-16-1 opensuse-tumbleweed
780 #, no-wrap
781 msgid "Autovivification"
782 msgstr "Auto-vivificare"
783
784 #. type: Plain text
785 #: debian-trixie debian-unstable
786 msgid ""
787 "References of the appropriate type can spring into existence if you "
788 "dereference them in a context that assumes they exist. Because we haven't "
789 "talked about dereferencing yet, we can't show you any examples yet."
790 msgstr ""
791
792 #. type: Plain text
793 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
794 #: opensuse-leap-16-1 opensuse-tumbleweed
795 msgid "I<Typeglob Slots>"
796 msgstr ""
797
798 #. type: IX
799 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
800 #: opensuse-leap-16-1 opensuse-tumbleweed
801 #, no-wrap
802 msgid "*foo{THING} *"
803 msgstr "*foo{THING} *"
804
805 #. type: IX
806 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
807 #: opensuse-leap-16-1 opensuse-tumbleweed
808 #, no-wrap
809 msgid "Typeglob Slots"
810 msgstr ""
811
812 #. type: Plain text
813 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
814 #: opensuse-leap-16-1 opensuse-tumbleweed
815 msgid ""
816 "A reference can be created by using a special syntax, lovingly known as the "
817 "*foo{THING} syntax. *foo{THING} returns a reference to the THING slot in "
818 "*foo (which is the symbol table entry which holds everything known as foo)."
819 msgstr ""
820
821 #. type: Plain text
822 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
823 #: opensuse-leap-16-1 opensuse-tumbleweed
824 #, no-wrap
825 msgid ""
826 "\\& $scalarref = *foo{SCALAR};\n"
827 "\\& $arrayref = *ARGV{ARRAY};\n"
828 "\\& $hashref = *ENV{HASH};\n"
829 "\\& $coderef = *handler{CODE};\n"
830 "\\& $ioref = *STDIN{IO};\n"
831 "\\& $globref = *foo{GLOB};\n"
832 "\\& $formatref = *foo{FORMAT};\n"
833 "\\& $globname = *foo{NAME}; # \"foo\"\n"
834 "\\& $pkgname = *foo{PACKAGE}; # \"main\"\n"
835 msgstr ""
836 "\\& $scalarref = *foo{SCALAR};\n"
837 "\\& $arrayref = *ARGV{ARRAY};\n"
838 "\\& $hashref = *ENV{HASH};\n"
839 "\\& $coderef = *handler{CODE};\n"
840 "\\& $ioref = *STDIN{IO};\n"
841 "\\& $globref = *foo{GLOB};\n"
842 "\\& $formatref = *foo{FORMAT};\n"
843 "\\& $globname = *foo{NAME}; # \"foo\"\n"
844 "\\& $pkgname = *foo{PACKAGE}; # \"main\"\n"
845
846 #. type: Plain text
847 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
848 #: opensuse-leap-16-1 opensuse-tumbleweed
849 msgid ""
850 "Most of these are self-explanatory, but CW<*foo{IO}> deserves special "
851 "attention. It returns the IO handle, used for file handles (\"open\" in "
852 "perlfunc), sockets (\"socket\" in perlfunc and \"socketpair\" in perlfunc), "
853 "and directory handles (\"opendir\" in perlfunc). For compatibility with "
854 "previous versions of Perl, CW<*foo{FILEHANDLE}> is a synonym for CW<*foo{IO}"
855 ">, though it is discouraged, to encourage a consistent use of one name: IO. "
856 "On perls between v5.8 and v5.22, it will issue a deprecation warning, but "
857 "this deprecation has since been rescinded."
858 msgstr ""
859
860 #. type: Plain text
861 #: debian-trixie debian-unstable
862 msgid ""
863 "\\&CW<*foo{THING}> returns undef if that particular THING hasn't been used "
864 "yet, except in the case of scalars. CW<*foo{SCALAR}> returns a reference to "
865 "an anonymous scalar if CW<$foo> hasn't been used yet. This might change in "
866 "a future release."
867 msgstr ""
868
869 #. type: Plain text
870 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
871 #: opensuse-leap-16-1 opensuse-tumbleweed
872 msgid ""
873 "\\&CW<*foo{NAME}> and CW<*foo{PACKAGE}> are the exception, in that they "
874 "return strings, rather than references. These return the package and name "
875 "of the typeglob itself, rather than one that has been assigned to it. So, "
876 "after \\&CW<\\*(C`*foo=*Foo::bar\\*(C'>, CW<*foo> will become \"*Foo::bar\" "
877 "when used as a string, but CW<*foo{PACKAGE}> and CW<*foo{NAME}> will "
878 "continue to produce \"main\" and \"foo\", respectively."
879 msgstr ""
880
881 #. type: Plain text
882 #: debian-trixie debian-unstable
883 msgid ""
884 "\\&CW<*foo{IO}> is an alternative to the CW<*HANDLE> mechanism given in "
885 "\"Typeglobs and Filehandles\" in perldata for passing filehandles into or "
886 "out of subroutines, or storing into larger data structures. Its "
887 "disadvantage is that it won't create a new filehandle for you. Its "
888 "advantage is that you have less risk of clobbering more than you want to "
889 "with a typeglob assignment. (It still conflates file and directory handles, "
890 "though.) However, if you assign the incoming value to a scalar instead of a "
891 "typeglob as we do in the examples below, there's no risk of that happening."
892 msgstr ""
893
894 #. type: Plain text
895 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
896 #: opensuse-leap-16-1 opensuse-tumbleweed
897 #, no-wrap
898 msgid ""
899 "\\& splutter(*STDOUT); # pass the whole glob\n"
900 "\\& splutter(*STDOUT{IO}); # pass both file and dir handles\n"
901 "\\&\n"
902 "\\& sub splutter {\n"
903 "\\& my $fh = shift;\n"
904 "\\& print $fh \"her um well a hmmm\\en\";\n"
905 "\\& }\n"
906 "\\&\n"
907 "\\& $rec = get_rec(*STDIN); # pass the whole glob\n"
908 "\\& $rec = get_rec(*STDIN{IO}); # pass both file and dir handles\n"
909 "\\&\n"
910 "\\& sub get_rec {\n"
911 "\\& my $fh = shift;\n"
912 "\\& return scalar E<lt>$fhE<gt>;\n"
913 "\\& }\n"
914 msgstr ""
915 "\\& splutter(*STDOUT); # pasează tot modelul global\n"
916 "\\& splutter(*STDOUT{IO}); # pasează atât identificatorii de fișiere, cât și cei de directoare\n"
917 "\\&\n"
918 "\\& sub splutter {\n"
919 "\\& my $fh = shift;\n"
920 "\\& print $fh \"ei, păi, a... hmmm\\en\";\n"
921 "\\& }\n"
922 "\\&\n"
923 "\\& $rec = get_rec(*STDIN); # pasează tot modelul global\n"
924 "\\& $rec = get_rec(*STDIN{IO}); # pasează atât identificatorii de fișiere, cât și cei de directoare\n"
925 "\\&\n"
926 "\\& sub get_rec {\n"
927 "\\& my $fh = shift;\n"
928 "\\& return scalar E<lt>$fhE<gt>;\n"
929 "\\& }\n"
930
931 #. type: IX
932 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
933 #: opensuse-leap-16-1 opensuse-tumbleweed
934 #, no-wrap
935 msgid "Using References"
936 msgstr "Utilizarea referințelor"
937
938 #. type: IX
939 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
940 #: opensuse-leap-16-1 opensuse-tumbleweed
941 #, no-wrap
942 msgid "reference, use dereferencing dereference"
943 msgstr ""
944
945 #. type: Plain text
946 #: debian-trixie debian-unstable
947 msgid ""
948 "That's it for creating references. By now you're probably dying to know how "
949 "to use references to get back to your long-lost data. There are several "
950 "basic methods."
951 msgstr ""
952 "Cam asta e tot în ceea ce privește crearea referințelor. Probabil că acum "
953 "ești nerăbdător să afli cum poți folosi referințele pentru a recupera datele "
954 "pierdute de mult. Există câteva metode de bază."
955
956 #. type: Plain text
957 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
958 #: opensuse-leap-16-1 opensuse-tumbleweed
959 msgid "I<Simple Scalar>"
960 msgstr "I<Scalar simplu>"
961
962 #. type: IX
963 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
964 #: opensuse-leap-16-1 opensuse-tumbleweed
965 #, no-wrap
966 msgid "Simple Scalar"
967 msgstr "Scalar simplu"
968
969 #. type: Plain text
970 #: debian-trixie debian-unstable
971 msgid ""
972 "Anywhere you'd put an identifier (or chain of identifiers) as part of a "
973 "variable or subroutine name, you can replace the identifier with a simple "
974 "scalar variable containing a reference of the correct type:"
975 msgstr ""
976 "Oriunde ai introduce un identificator (sau un șir de identificatori) ca "
977 "parte a numelui unei variabile sau al unei subrutine, poți înlocui "
978 "identificatorul cu o variabilă scalară simplă care conține o referință de "
979 "tipul corespunzător:"
980
981 #. type: Plain text
982 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
983 #: opensuse-leap-16-1 opensuse-tumbleweed
984 #, no-wrap
985 msgid ""
986 "\\& $bar = $$scalarref;\n"
987 "\\& push(@$arrayref, $filename);\n"
988 "\\& $$arrayref[0] = \"January\";\n"
989 "\\& $$hashref{\"KEY\"} = \"VALUE\";\n"
990 "\\& &$coderef(1,2,3);\n"
991 "\\& print $globref \"output\\en\";\n"
992 msgstr ""
993 "\\& $bar = $$scalarref;\n"
994 "\\& push(@$arrayref, $filename);\n"
995 "\\& $$arrayref[0] = \"Ianuarie\";\n"
996 "\\& $$hashref{\"CHEIE\"} = \"VALOARE\";\n"
997 "\\& &$coderef(1,2,3);\n"
998 "\\& print $globref \"rezultatul\\en\";\n"
999
1000 #. type: Plain text
1001 #: debian-trixie debian-unstable
1002 msgid ""
1003 "It's important to understand that we are specifically I<not> dereferencing "
1004 "\\&CW<$arrayref[0]> or CW<$hashref{\"KEY\"}> there. The dereference of the "
1005 "scalar variable happens I<before> it does any key lookups. Anything more "
1006 "complicated than a simple scalar variable must use methods 2 or 3 below. "
1007 "However, a \"simple scalar\" includes an identifier that itself uses method "
1008 "1 recursively. Therefore, the following prints \"howdy\"."
1009 msgstr ""
1010
1011 #. type: Plain text
1012 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1013 #: opensuse-leap-16-1 opensuse-tumbleweed
1014 #, no-wrap
1015 msgid ""
1016 "\\& $refrefref = \\e\\e\\e\"howdy\";\n"
1017 "\\& print $$$$refrefref;\n"
1018 msgstr ""
1019 "\\& $refrefref = \\e\\e\\e\"salutări\";\n"
1020 "\\& print $$$$refrefref;\n"
1021
1022 #. type: Plain text
1023 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1024 #: opensuse-leap-16-1 opensuse-tumbleweed
1025 msgid "I<Block>"
1026 msgstr "I<Bloc>"
1027
1028 #. type: IX
1029 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1030 #: opensuse-leap-16-1 opensuse-tumbleweed
1031 #, no-wrap
1032 msgid "Block"
1033 msgstr "Bloc"
1034
1035 #. type: Plain text
1036 #: debian-trixie debian-unstable
1037 msgid ""
1038 "Anywhere you'd put an identifier (or chain of identifiers) as part of a "
1039 "variable or subroutine name, you can replace the identifier with a BLOCK "
1040 "returning a reference of the correct type. In other words, the previous "
1041 "examples could be written like this:"
1042 msgstr ""
1043
1044 #. type: Plain text
1045 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1046 #: opensuse-leap-16-1 opensuse-tumbleweed
1047 #, no-wrap
1048 msgid ""
1049 "\\& $bar = ${$scalarref};\n"
1050 "\\& push(@{$arrayref}, $filename);\n"
1051 "\\& ${$arrayref}[0] = \"January\";\n"
1052 "\\& ${$hashref}{\"KEY\"} = \"VALUE\";\n"
1053 "\\& &{$coderef}(1,2,3);\n"
1054 "\\& $globref-E<gt>print(\"output\\en\"); # iff IO::Handle is loaded\n"
1055 msgstr ""
1056 "\\& $bar = ${$scalarref};\n"
1057 "\\& push(@{$arrayref}, $filename);\n"
1058 "\\& ${$arrayref}[0] = \"January\";\n"
1059 "\\& ${$hashref}{\"KEY\"} = \"VALUE\";\n"
1060 "\\& &{$coderef}(1,2,3);\n"
1061 "\\& $globref-E<gt>print(\"output\\en\"); # dacă IO::Handle este încărcat\n"
1062
1063 #. type: Plain text
1064 #: debian-trixie debian-unstable
1065 msgid ""
1066 "Admittedly, it's a little silly to use the curlies in this case, but the "
1067 "BLOCK can contain any arbitrary expression, in particular, subscripted "
1068 "expressions:"
1069 msgstr ""
1070 "Recunosc, e cam ridicol să folosești acoladele în acest caz, dar BLOCUL "
1071 "poate conține orice expresie arbitrară, în special expresii cu indice:"
1072
1073 #. type: Plain text
1074 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1075 #: opensuse-leap-16-1 opensuse-tumbleweed
1076 #, no-wrap
1077 msgid "\\& &{ $dispatch{$index} }(1,2,3); # call correct routine\n"
1078 msgstr "\\& &{ $dispatch{$index} }(1,2,3); # apelează rutina corectă\n"
1079
1080 #. type: Plain text
1081 #: debian-trixie debian-unstable
1082 msgid ""
1083 "Because of being able to omit the curlies for the simple case of CW<$$x>, "
1084 "people often make the mistake of viewing the dereferencing symbols as proper "
1085 "operators, and wonder about their precedence. If they were, though, you "
1086 "could use parentheses instead of braces. That's not the case. Consider the "
1087 "difference below; case 0 is a short-hand version of case 1, \\&I<not> case 2:"
1088 msgstr ""
1089
1090 #. type: Plain text
1091 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1092 #: opensuse-leap-16-1 opensuse-tumbleweed
1093 #, no-wrap
1094 msgid ""
1095 "\\& $$hashref{\"KEY\"} = \"VALUE\"; # CASE 0\n"
1096 "\\& ${$hashref}{\"KEY\"} = \"VALUE\"; # CASE 1\n"
1097 "\\& ${$hashref{\"KEY\"}} = \"VALUE\"; # CASE 2\n"
1098 "\\& ${$hashref-E<gt>{\"KEY\"}} = \"VALUE\"; # CASE 3\n"
1099 msgstr ""
1100 "\\& $$hashref{\"CHEIE\"} = \"VALOARE\"; # CAZUL 0\n"
1101 "\\& ${$hashref}{\"CHEIE\"} = \"VALOARE\"; # CAZUL 1\n"
1102 "\\& ${$hashref{\"CHEIE\"}} = \"VALOARE\"; # CAZUL 2\n"
1103 "\\& ${$hashref-E<gt>{\"CHEIE\"}} = \"VALOARE\"; # CAZUL 3\n"
1104
1105 #. type: Plain text
1106 #: debian-trixie debian-unstable
1107 msgid ""
1108 "Case 2 is also deceptive in that you're accessing a variable called "
1109 "CW<%hashref>, not dereferencing through CW<$hashref> to the hash it's "
1110 "presumably referencing. That would be case 3."
1111 msgstr ""
1112 "Cazul 2 este, de asemenea, înșelător, întrucât accesați o variabilă numită "
1113 "CW<%hashref>, nu efectuați o dereferențiere prin CW<$hashref> către hash-ul "
1114 "la care se presupune că face referire. Acesta ar fi cazul 3."
1115
1116 #. type: Plain text
1117 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1118 #: opensuse-leap-16-1 opensuse-tumbleweed
1119 msgid "I<Arrow Notation>"
1120 msgstr "I<Notația cu săgeți>"
1121
1122 #. type: IX
1123 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1124 #: opensuse-leap-16-1 opensuse-tumbleweed
1125 #, no-wrap
1126 msgid "Arrow Notation"
1127 msgstr "Notația cu săgeți"
1128
1129 #. type: Plain text
1130 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1131 #: opensuse-leap-16-1 opensuse-tumbleweed
1132 msgid ""
1133 "Subroutine calls and lookups of individual array elements arise often enough "
1134 "that it gets cumbersome to use method 2. As a form of syntactic sugar, the "
1135 "examples for method 2 may be written:"
1136 msgstr ""
1137
1138 #. type: Plain text
1139 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1140 #: opensuse-leap-16-1 opensuse-tumbleweed
1141 #, no-wrap
1142 msgid ""
1143 "\\& $arrayref-E<gt>[0] = \"January\"; # Array element\n"
1144 "\\& $hashref-E<gt>{\"KEY\"} = \"VALUE\"; # Hash element\n"
1145 "\\& $coderef-E<gt>(1,2,3); # Subroutine call\n"
1146 msgstr ""
1147 "\\& $arrayref-E<gt>[0] = \"Ianuarie\"; # Element de matrice\n"
1148 "\\& $hashref-E<gt>{\"CHEIE\"} = \"VALOARE\"; # Element hash\n"
1149 "\\& $coderef-E<gt>(1,2,3); # Apel subrutină\n"
1150
1151 #. type: Plain text
1152 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1153 #: opensuse-leap-16-1 opensuse-tumbleweed
1154 msgid ""
1155 "The left side of the arrow can be any expression returning a reference, "
1156 "including a previous dereference. Note that CW<$array[$x]> is I<not> the "
1157 "same thing as CW<\\*(C`$array-E<gt>[$x]\\*(C'> here:"
1158 msgstr ""
1159
1160 #. type: Plain text
1161 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1162 #: opensuse-leap-16-1 opensuse-tumbleweed
1163 #, no-wrap
1164 msgid "\\& $array[$x]-E<gt>{\"foo\"}-E<gt>[0] = \"January\";\n"
1165 msgstr "\\& $array[$x]-E<gt>{\"foo\"}-E<gt>[0] = \"Ianuarie\";\n"
1166
1167 #. type: Plain text
1168 #: debian-trixie debian-unstable
1169 msgid ""
1170 "This is one of the cases we mentioned earlier in which references could "
1171 "spring into existence when in an lvalue context. Before this statement, "
1172 "CW<$array[$x]> may have been undefined. If so, it's automatically defined "
1173 "with a hash reference so that we can look up \\&CW<\\*(C`{\"foo\"}\\*(C'> in "
1174 "it. Likewise CW<\\*(C`$array[$x]-E<gt>{\"foo\"}\\*(C'> will automatically "
1175 "get defined with an array reference so that we can look up "
1176 "CW<\\*(C`[0]\\*(C'> in it. This process is called I<autovivification>."
1177 msgstr ""
1178
1179 #. type: Plain text
1180 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1181 #: opensuse-leap-16-1 opensuse-tumbleweed
1182 msgid ""
1183 "One more thing here. The arrow is optional I<between> brackets subscripts, "
1184 "so you can shrink the above down to"
1185 msgstr ""
1186 "Încă un lucru. Săgeata este opțională între parantezele drepte care indică "
1187 "indicii, așa că poți simplifica expresia de mai sus astfel:"
1188
1189 #. type: Plain text
1190 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1191 #: opensuse-leap-16-1 opensuse-tumbleweed
1192 #, no-wrap
1193 msgid "\\& $array[$x]{\"foo\"}[0] = \"January\";\n"
1194 msgstr "\\& $array[$x]{\"foo\"}[0] = \"Ianuarie\";\n"
1195
1196 #. type: Plain text
1197 #: debian-trixie debian-unstable
1198 msgid ""
1199 "Which, in the degenerate case of using only ordinary arrays, gives you "
1200 "multidimensional arrays just like C's:"
1201 msgstr ""
1202 "Ceea ce, în cazul extrem al utilizării exclusiv a matricilor obișnuite, duce "
1203 "la obținerea unor matrici multidimensionale identice cu cele din limbajul C:"
1204
1205 #. type: Plain text
1206 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1207 #: opensuse-leap-16-1 opensuse-tumbleweed
1208 #, no-wrap
1209 msgid "\\& $score[$x][$y][$z] += 42;\n"
1210 msgstr "\\& $score[$x][$y][$z] += 42;\n"
1211
1212 #. type: Plain text
1213 #: debian-trixie debian-unstable
1214 msgid ""
1215 "Well, okay, not entirely like C's arrays, actually. C doesn't know how to "
1216 "grow its arrays on demand. Perl does."
1217 msgstr ""
1218 "Ei bine, de fapt, nu chiar ca matricile C. C nu știe să-și extindă matricile "
1219 "la cerere. Perl știe."
1220
1221 #. type: Plain text
1222 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1223 #: opensuse-leap-16-1 opensuse-tumbleweed
1224 msgid "I<Objects>"
1225 msgstr "I<Obiecte>"
1226
1227 #. type: IX
1228 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1229 #: opensuse-leap-16-1 opensuse-tumbleweed
1230 #, no-wrap
1231 msgid "Objects"
1232 msgstr "Obiecte"
1233
1234 #. type: Plain text
1235 #: debian-trixie debian-unstable
1236 msgid ""
1237 "If a reference happens to be a reference to an object, then there are "
1238 "probably methods to access the things referred to, and you should probably "
1239 "stick to those methods unless you're in the class package that defines the "
1240 "object's methods. In other words, be nice, and don't violate the object's "
1241 "encapsulation without a very good reason. Perl does not enforce "
1242 "encapsulation. We are not totalitarians here. We do expect some basic "
1243 "civility though."
1244 msgstr ""
1245
1246 #. type: Plain text
1247 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1248 #: opensuse-leap-16-1 opensuse-tumbleweed
1249 msgid "I<Miscellaneous Usage>"
1250 msgstr "I<Utilizări diverse>"
1251
1252 #. type: IX
1253 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1254 #: opensuse-leap-16-1 opensuse-tumbleweed
1255 #, no-wrap
1256 msgid "Miscellaneous Usage"
1257 msgstr "Utilizări diverse"
1258
1259 #. type: Plain text
1260 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1261 #: opensuse-leap-16-1 opensuse-tumbleweed
1262 msgid ""
1263 "Using a string or number as a reference produces a symbolic reference, as "
1264 "explained above. Using a reference as a number produces an integer "
1265 "representing its storage location in memory. The only useful thing to be "
1266 "done with this is to compare two references numerically to see whether they "
1267 "refer to the same location."
1268 msgstr ""
1269
1270 #. type: IX
1271 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1272 #: opensuse-leap-16-1 opensuse-tumbleweed
1273 #, no-wrap
1274 msgid "reference, numeric context"
1275 msgstr "referință, context numeric"
1276
1277 #. type: Plain text
1278 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1279 #: opensuse-leap-16-1 opensuse-tumbleweed
1280 #, no-wrap
1281 msgid ""
1282 "\\& if ($ref1 == $ref2) { # cheap numeric compare of references\n"
1283 "\\& print \"refs 1 and 2 refer to the same thing\\en\";\n"
1284 "\\& }\n"
1285 msgstr ""
1286 "\\& if ($ref1 == $ref2) { # comparare numerică simplă a referințelor\n"
1287 "\\& print \"referințele 1 și 2 se referă la același lucru\\en\";\n"
1288 "\\& }\n"
1289
1290 #. type: Plain text
1291 #: debian-trixie debian-unstable
1292 msgid ""
1293 "Using a reference as a string produces both its referent's type, including "
1294 "any package blessing as described in perlobj, as well as the numeric address "
1295 "expressed in hex. The B<ref()> operator returns just the type of thing the "
1296 "reference is pointing to, without the address. See \"ref\" in perlfunc for "
1297 "details and examples of its use."
1298 msgstr ""
1299
1300 #. type: IX
1301 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1302 #: opensuse-leap-16-1 opensuse-tumbleweed
1303 #, no-wrap
1304 msgid "reference, string context"
1305 msgstr "referință, context de șir"
1306
1307 #. type: Plain text
1308 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1309 #: opensuse-leap-16-1 opensuse-tumbleweed
1310 msgid ""
1311 "The B<bless()> operator may be used to associate the object a reference "
1312 "points to with a package functioning as an object class. See perlobj."
1313 msgstr ""
1314 "Operatorul B<bless()> poate fi utilizat pentru a asocia obiectul la care "
1315 "face referire o referință cu un pachet care funcționează ca o clasă de "
1316 "obiecte. Vezi perlobj."
1317
1318 #. type: Plain text
1319 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1320 #: opensuse-leap-16-1 opensuse-tumbleweed
1321 msgid ""
1322 "A typeglob may be dereferenced the same way a reference can, because the "
1323 "dereference syntax always indicates the type of reference desired. So "
1324 "CW<\\*(C`${*foo}\\*(C'> and CW<\\*(C`${\\e$foo}\\*(C'> both indicate the "
1325 "same scalar variable."
1326 msgstr ""
1327
1328 #. type: Plain text
1329 #: debian-trixie debian-unstable
1330 msgid "Here's a trick for interpolating a subroutine call into a string:"
1331 msgstr ""
1332 "Iată o șmecherie pentru a insera un apel de subrutină într-un șir de "
1333 "caractere:"
1334
1335 #. type: Plain text
1336 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1337 #: opensuse-leap-16-1 opensuse-tumbleweed
1338 #, no-wrap
1339 msgid "\\& print \"My sub returned @{[mysub(1,2,3)]} that time.\\en\";\n"
1340 msgstr "\\& print \"Subrutina mea a returnat @{[mysub(1,2,3)]} de data aceasta.\\en\";\n"
1341
1342 #. type: Plain text
1343 #: debian-trixie debian-unstable
1344 msgid ""
1345 "The way it works is that when the CW<\\*(C`@{...}\\*(C'> is seen in the "
1346 "double-quoted string, it's evaluated as a block. The block creates a "
1347 "reference to an anonymous array containing the results of the call to "
1348 "CW<\\*(C`mysub(1,2,3)\\*(C'>. So the whole block returns a reference to an "
1349 "array, which is then dereferenced by CW<\\*(C`@{...}\\*(C'> and stuck into "
1350 "the double-quoted string. This chicanery is also useful for arbitrary "
1351 "expressions:"
1352 msgstr ""
1353
1354 #. type: Plain text
1355 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1356 #: opensuse-leap-16-1 opensuse-tumbleweed
1357 #, no-wrap
1358 msgid "\\& print \"That yields @{[$n + 5]} widgets\\en\";\n"
1359 msgstr "\\& print \"Aceasta produce @{[$n + 5]} widget-uri\\en\";\n"
1360
1361 #. type: Plain text
1362 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1363 #: opensuse-leap-16-1 opensuse-tumbleweed
1364 msgid ""
1365 "Similarly, an expression that returns a reference to a scalar can be "
1366 "dereferenced via CW<\\*(C`${...}\\*(C'>. Thus, the above expression may be "
1367 "written as:"
1368 msgstr ""
1369 "În mod similar, o expresie care returnează o referință la un scalar poate fi "
1370 "dereferențiată folosind CW<„${...}”>. Astfel, expresia de mai sus poate fi "
1371 "scrisă astfel:"
1372
1373 #. type: Plain text
1374 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1375 #: opensuse-leap-16-1 opensuse-tumbleweed
1376 #, no-wrap
1377 msgid "\\& print \"That yields ${\\e($n + 5)} widgets\\en\";\n"
1378 msgstr "\\& print \"Aceasta produce ${\\e($n + 5)} widget-uri\\en\";\n"
1379
1380 #. type: IX
1381 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1382 #: opensuse-leap-16-1 opensuse-tumbleweed
1383 #, no-wrap
1384 msgid "Circular References"
1385 msgstr "Referințe circulare"
1386
1387 #. type: IX
1388 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1389 #: opensuse-leap-16-1 opensuse-tumbleweed
1390 #, no-wrap
1391 msgid "circular reference reference, circular"
1392 msgstr "referință circulară referință, circulară"
1393
1394 #. type: Plain text
1395 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1396 #: opensuse-leap-16-1 opensuse-tumbleweed
1397 msgid ""
1398 "It is possible to create a \"circular reference\" in Perl, which can lead to "
1399 "memory leaks. A circular reference occurs when two references contain a "
1400 "reference to each other, like this:"
1401 msgstr ""
1402 "În Perl este posibil să se creeze o „referință circulară”, care poate duce "
1403 "la pierderi de memorie. O referință circulară apare atunci când două "
1404 "referințe conțin o referință una la cealaltă, după cum urmează:"
1405
1406 #. type: Plain text
1407 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1408 #: opensuse-leap-16-1 opensuse-tumbleweed
1409 #, no-wrap
1410 msgid ""
1411 "\\& my $foo = {};\n"
1412 "\\& my $bar = { foo =E<gt> $foo };\n"
1413 "\\& $foo-E<gt>{bar} = $bar;\n"
1414 msgstr ""
1415 "\\& my $foo = {};\n"
1416 "\\& my $bar = { foo =E<gt> $foo };\n"
1417 "\\& $foo-E<gt>{bar} = $bar;\n"
1418
1419 #. type: Plain text
1420 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1421 #: opensuse-leap-16-1 opensuse-tumbleweed
1422 msgid "You can also create a circular reference with a single variable:"
1423 msgstr ""
1424 "De asemenea, puteți crea o referință circulară folosind o singură variabilă:"
1425
1426 #. type: Plain text
1427 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1428 #: opensuse-leap-16-1 opensuse-tumbleweed
1429 #, no-wrap
1430 msgid ""
1431 "\\& my $foo;\n"
1432 "\\& $foo = \\e$foo;\n"
1433 msgstr ""
1434 "\\& my $foo;\n"
1435 "\\& $foo = \\e$foo;\n"
1436
1437 #. type: Plain text
1438 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1439 #: opensuse-leap-16-1 opensuse-tumbleweed
1440 msgid ""
1441 "In this case, the reference count for the variables will never reach 0, and "
1442 "the references will never be garbage-collected. This can lead to memory "
1443 "leaks."
1444 msgstr ""
1445 "În acest caz, numărul de referințe pentru variabile nu va ajunge niciodată "
1446 "la 0, iar referințele nu vor fi niciodată eliminate de mecanismul de "
1447 "colectare a deșeurilor. Acest lucru poate duce la scurgeri(pierderi) de "
1448 "memorie."
1449
1450 #. type: Plain text
1451 #: debian-trixie debian-unstable
1452 msgid ""
1453 "Because objects in Perl are implemented as references, it's possible to have "
1454 "circular references with objects as well. Imagine a TreeNode class where "
1455 "each node references its parent and child nodes. Any node with a parent will "
1456 "be part of a circular reference."
1457 msgstr ""
1458
1459 #. type: Plain text
1460 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1461 #: opensuse-leap-16-1 opensuse-tumbleweed
1462 msgid ""
1463 "You can break circular references by creating a \"weak reference\". A weak "
1464 "reference does not increment the reference count for a variable, which means "
1465 "that the object can go out of scope and be destroyed. You can weaken a "
1466 "reference with the CW<\\*(C`weaken\\*(C'> function exported by the "
1467 "Scalar::Util module, or available as CW<\\*(C`builtin::weaken\\*(C'> "
1468 "directly in Perl version 5.35.7 or later."
1469 msgstr ""
1470
1471 #. type: Plain text
1472 #: debian-trixie debian-unstable
1473 msgid "Here's how we can make the first example safer:"
1474 msgstr "Iată cum putem face primul exemplu mai sigur:"
1475
1476 #. type: Plain text
1477 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1478 #: opensuse-leap-16-1 opensuse-tumbleweed
1479 #, no-wrap
1480 msgid ""
1481 "\\& use Scalar::Util \\*(Aqweaken\\*(Aq;\n"
1482 "\\&\n"
1483 "\\& my $foo = {};\n"
1484 "\\& my $bar = { foo =E<gt> $foo };\n"
1485 "\\& $foo-E<gt>{bar} = $bar;\n"
1486 "\\&\n"
1487 "\\& weaken $foo-E<gt>{bar};\n"
1488 msgstr ""
1489 "\\& use Scalar::Util \\*(Aqweaken\\*(Aq;\n"
1490 "\\&\n"
1491 "\\& my $foo = {};\n"
1492 "\\& my $bar = { foo =E<gt> $foo };\n"
1493 "\\& $foo-E<gt>{bar} = $bar;\n"
1494 "\\&\n"
1495 "\\& weaken $foo-E<gt>{bar};\n"
1496
1497 #. type: Plain text
1498 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1499 #: opensuse-leap-16-1 opensuse-tumbleweed
1500 msgid ""
1501 "The reference from CW<$foo> to CW<$bar> has been weakened. When the "
1502 "\\&CW<$bar> variable goes out of scope, it will be garbage-collected. The "
1503 "next time you look at the value of the CW<\\*(C`$foo-E<gt>{bar}\\*(C'> key, "
1504 "it will be CW<\\*(C`undef\\*(C'>."
1505 msgstr ""
1506
1507 #. type: Plain text
1508 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1509 #: opensuse-leap-16-1 opensuse-tumbleweed
1510 msgid ""
1511 "This action at a distance can be confusing, so you should be careful with "
1512 "your use of weaken. You should weaken the reference in the variable that "
1513 "will go out of scope I<first>. That way, the longer-lived variable will "
1514 "contain the expected reference until it goes out of scope."
1515 msgstr ""
1516
1517 #. type: IX
1518 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1519 #: opensuse-leap-16-1 opensuse-tumbleweed
1520 #, no-wrap
1521 msgid "Symbolic references"
1522 msgstr "Referințe simbolice"
1523
1524 #. type: Plain text
1525 #: debian-trixie debian-unstable
1526 msgid ""
1527 "We said that references spring into existence as necessary if they are "
1528 "undefined, but we didn't say what happens if a value used as a reference is "
1529 "already defined, but I<isn't> a hard reference. If you use it as a "
1530 "reference, it'll be treated as a symbolic reference. That is, the value of "
1531 "the scalar is taken to be the I<name> of a variable, rather than a direct "
1532 "link to a (possibly) anonymous value."
1533 msgstr ""
1534
1535 #. type: Plain text
1536 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1537 #: opensuse-leap-16-1 opensuse-tumbleweed
1538 msgid "People frequently expect it to work like this. So it does."
1539 msgstr ""
1540 "Oamenii se așteaptă adesea ca lucrurile să funcționeze așa. Așa și este."
1541
1542 #. type: Plain text
1543 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1544 #: opensuse-leap-16-1 opensuse-tumbleweed
1545 #, no-wrap
1546 msgid ""
1547 "\\& $name = \"foo\";\n"
1548 "\\& $$name = 1; # Sets $foo\n"
1549 "\\& ${$name} = 2; # Sets $foo\n"
1550 "\\& ${$name x 2} = 3; # Sets $foofoo\n"
1551 "\\& $name-E<gt>[0] = 4; # Sets $foo[0]\n"
1552 "\\& @$name = (); # Clears @foo\n"
1553 "\\& &$name(); # Calls &foo()\n"
1554 "\\& $pack = \"THAT\";\n"
1555 "\\& ${\"${pack}::$name\"} = 5; # Sets $THAT::foo without eval\n"
1556 msgstr ""
1557 "\\& $name = \"foo\";\n"
1558 "\\& $$name = 1; # Sets $foo\n"
1559 "\\& ${$name} = 2; # Definește $foo\n"
1560 "\\& ${$name x 2} = 3; # Definește $foofoo\n"
1561 "\\& $name-E<gt>[0] = 4; # Definește $foo[0]\n"
1562 "\\& @$name = (); # Curăță @foo\n"
1563 "\\& &$name(); # Apelează &foo()\n"
1564 "\\& $pack = \"THAT\";\n"
1565 "\\& ${\"${pack}::$name\"} = 5; # Definește $THAT::foo fără eval\n"
1566
1567 #. type: Plain text
1568 #: debian-trixie debian-unstable
1569 msgid ""
1570 "This is powerful, and slightly dangerous, in that it's possible to intend "
1571 "(with the utmost sincerity) to use a hard reference, and accidentally use a "
1572 "symbolic reference instead. To protect against that, you can say"
1573 msgstr ""
1574 "Acest lucru este foarte eficient, dar și puțin riscant, în sensul că este "
1575 "posibil să intenționezi (cu cea mai mare sinceritate) să folosești o "
1576 "referință directă, dar să folosești din greșeală o referință simbolică. "
1577 "Pentru a evita acest lucru, poți scrie"
1578
1579 #. type: Plain text
1580 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1581 #: opensuse-leap-16-1 opensuse-tumbleweed
1582 #, no-wrap
1583 msgid "\\& use strict \\*(Aqrefs\\*(Aq;\n"
1584 msgstr "\\& use strict \\*(Aqrefs\\*(Aq;\n"
1585
1586 #. type: Plain text
1587 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1588 #: opensuse-leap-16-1 opensuse-tumbleweed
1589 msgid ""
1590 "and then only hard references will be allowed for the rest of the enclosing "
1591 "block. An inner block may countermand that with"
1592 msgstr ""
1593 "iar pentru restul blocului cuprinzător vor fi permise doar referințe "
1594 "directe. Un bloc interior poate anula această regulă cu ajutorul"
1595
1596 #. type: Plain text
1597 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1598 #: opensuse-leap-16-1 opensuse-tumbleweed
1599 #, no-wrap
1600 msgid "\\& no strict \\*(Aqrefs\\*(Aq;\n"
1601 msgstr "\\& no strict \\*(Aqrefs\\*(Aq;\n"
1602
1603 #. type: Plain text
1604 #: debian-trixie debian-unstable
1605 msgid ""
1606 "Only package variables (globals, even if localized) are visible to symbolic "
1607 "references. Lexical variables (declared with B<my()>) aren't in a symbol "
1608 "table, and thus are invisible to this mechanism. For example:"
1609 msgstr ""
1610
1611 #. type: Plain text
1612 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1613 #: opensuse-leap-16-1 opensuse-tumbleweed
1614 #, no-wrap
1615 msgid ""
1616 "\\& local $value = 10;\n"
1617 "\\& $ref = \"value\";\n"
1618 "\\& {\n"
1619 "\\& my $value = 20;\n"
1620 "\\& print $$ref;\n"
1621 "\\& }\n"
1622 msgstr ""
1623 "\\& local $value = 10;\n"
1624 "\\& $ref = \"value\";\n"
1625 "\\& {\n"
1626 "\\& my $value = 20;\n"
1627 "\\& print $$ref;\n"
1628 "\\& }\n"
1629
1630 #. type: Plain text
1631 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1632 #: opensuse-leap-16-1 opensuse-tumbleweed
1633 msgid ""
1634 "This will still print 10, not 20. Remember that B<local()> affects package "
1635 "variables, which are all \"global\" to the package."
1636 msgstr ""
1637 "Rezultatul va fi tot 10, nu 20. Rețineți că B<local()> afectează "
1638 "variabilele de pachet, care sunt toate „globale” la nivelul pachetului."
1639
1640 #. type: IX
1641 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1642 #: opensuse-leap-16-1 opensuse-tumbleweed
1643 #, no-wrap
1644 msgid "Not-so-symbolic references"
1645 msgstr ""
1646
1647 #. type: Plain text
1648 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1649 #: opensuse-leap-16-1 opensuse-tumbleweed
1650 msgid ""
1651 "Brackets around a symbolic reference can simply serve to isolate an "
1652 "identifier or variable name from the rest of an expression, just as they "
1653 "always have within a string. For example,"
1654 msgstr ""
1655
1656 #. type: Plain text
1657 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1658 #: opensuse-leap-16-1 opensuse-tumbleweed
1659 #, no-wrap
1660 msgid ""
1661 "\\& $push = \"pop on \";\n"
1662 "\\& print \"${push}over\";\n"
1663 msgstr ""
1664 "\\& $push = \"pop on \";\n"
1665 "\\& print \"${push}over\";\n"
1666
1667 #. type: Plain text
1668 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1669 #: opensuse-leap-16-1 opensuse-tumbleweed
1670 msgid ""
1671 "has always meant to print \"pop on over\", even though push is a reserved "
1672 "word. This is generalized to work the same without the enclosing double "
1673 "quotes, so that"
1674 msgstr ""
1675
1676 #. type: Plain text
1677 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1678 #: opensuse-leap-16-1 opensuse-tumbleweed
1679 #, no-wrap
1680 msgid "\\& print ${push} . \"over\";\n"
1681 msgstr "\\& print ${push} . \"over\";\n"
1682
1683 #. type: Plain text
1684 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1685 #: opensuse-leap-16-1 opensuse-tumbleweed
1686 msgid "and even"
1687 msgstr "și chiar"
1688
1689 #. type: Plain text
1690 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1691 #: opensuse-leap-16-1 opensuse-tumbleweed
1692 #, no-wrap
1693 msgid "\\& print ${ push } . \"over\";\n"
1694 msgstr "\\& print ${ push } . \"over\";\n"
1695
1696 #. type: Plain text
1697 #: debian-trixie debian-unstable
1698 msgid ""
1699 "will have the same effect. This construct is I<not> considered to be a "
1700 "symbolic reference when you're using strict refs:"
1701 msgstr ""
1702 "va avea același efect. Această construcție nu este considerată o referință "
1703 "simbolică atunci când se utilizează referințe stricte:"
1704
1705 #. type: Plain text
1706 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1707 #: opensuse-leap-16-1 opensuse-tumbleweed
1708 #, no-wrap
1709 msgid ""
1710 "\\& use strict \\*(Aqrefs\\*(Aq;\n"
1711 "\\& ${ bareword }; # Okay, means $bareword.\n"
1712 "\\& ${ \"bareword\" }; # Error, symbolic reference.\n"
1713 msgstr ""
1714 "\\& use strict \\*(Aqrefs\\*(Aq;\n"
1715 "\\& ${ bareword }; # În regulă, înseamnă $bareword.\n"
1716 "\\& ${ \"bareword\" }; # Eroare, referință simbolică.\n"
1717
1718 #. type: Plain text
1719 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1720 #: opensuse-leap-16-1 opensuse-tumbleweed
1721 msgid ""
1722 "Similarly, because of all the subscripting that is done using single words, "
1723 "the same rule applies to any bareword that is used for subscripting a hash. "
1724 "So now, instead of writing"
1725 msgstr ""
1726
1727 #. type: Plain text
1728 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1729 #: opensuse-leap-16-1 opensuse-tumbleweed
1730 #, no-wrap
1731 msgid "\\& $hash{ \"aaa\" }{ \"bbb\" }{ \"ccc\" }\n"
1732 msgstr "\\& $hash{ \"aaa\" }{ \"bbb\" }{ \"ccc\" }\n"
1733
1734 #. type: Plain text
1735 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1736 #: opensuse-leap-16-1 opensuse-tumbleweed
1737 msgid "you can write just"
1738 msgstr "poți scrie doar"
1739
1740 #. type: Plain text
1741 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1742 #: opensuse-leap-16-1 opensuse-tumbleweed
1743 #, no-wrap
1744 msgid "\\& $hash{ aaa }{ bbb }{ ccc }\n"
1745 msgstr "\\& $hash{ aaa }{ bbb }{ ccc }\n"
1746
1747 #. type: Plain text
1748 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1749 #: opensuse-leap-16-1 opensuse-tumbleweed
1750 msgid ""
1751 "and not worry about whether the subscripts are reserved words. In the rare "
1752 "event that you do wish to do something like"
1753 msgstr ""
1754 "fără să vă faceți griji dacă indicele este un cuvânt rezervat. În cazul rar "
1755 "în care doriți să faceți ceva precum"
1756
1757 #. type: Plain text
1758 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1759 #: opensuse-leap-16-1 opensuse-tumbleweed
1760 #, no-wrap
1761 msgid "\\& $hash{ shift }\n"
1762 msgstr "\\& $hash{ shift }\n"
1763
1764 #. type: Plain text
1765 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1766 #: opensuse-leap-16-1 opensuse-tumbleweed
1767 msgid ""
1768 "you can force interpretation as a reserved word by adding anything that "
1769 "makes it more than a bareword:"
1770 msgstr ""
1771 "puteți forța interpretarea ca cuvânt rezervat adăugând orice element care îl "
1772 "transformă într-un cuvânt complet:"
1773
1774 #. type: Plain text
1775 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1776 #: opensuse-leap-16-1 opensuse-tumbleweed
1777 #, no-wrap
1778 msgid ""
1779 "\\& $hash{ shift() }\n"
1780 "\\& $hash{ +shift }\n"
1781 "\\& $hash{ shift @_ }\n"
1782 msgstr ""
1783 "\\& $hash{ shift() }\n"
1784 "\\& $hash{ +shift }\n"
1785 "\\& $hash{ shift @_ }\n"
1786
1787 #. type: Plain text
1788 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1789 #: opensuse-leap-16-1 opensuse-tumbleweed
1790 msgid ""
1791 "The CW<\\*(C`use warnings\\*(C'> pragma or the B<-w> switch will warn you if "
1792 "it interprets a reserved word as a string. But it will no longer warn you "
1793 "about using lowercase words, because the string is effectively quoted."
1794 msgstr ""
1795
1796 #. type: IX
1797 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1798 #: opensuse-leap-16-1 opensuse-tumbleweed
1799 #, no-wrap
1800 msgid "Pseudo-hashes: Using an array as a hash"
1801 msgstr "Pseudo-hash-uri: Utilizarea unei matrice ca hash"
1802
1803 #. type: IX
1804 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1805 #: opensuse-leap-16-1 opensuse-tumbleweed
1806 #, no-wrap
1807 msgid "pseudo-hash pseudo hash pseudohash"
1808 msgstr ""
1809
1810 #. type: Plain text
1811 #: debian-trixie debian-unstable
1812 msgid ""
1813 "Pseudo-hashes have been removed from Perl. The 'fields' pragma remains "
1814 "available."
1815 msgstr ""
1816 "Pseudo-hash-urile au fost eliminate din Perl. Pragma „fields” rămâne "
1817 "disponibilă."
1818
1819 #. type: IX
1820 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1821 #: opensuse-leap-16-1 opensuse-tumbleweed
1822 #, no-wrap
1823 msgid "Function Templates"
1824 msgstr "Șabloane de funcții"
1825
1826 #. type: IX
1827 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1828 #: opensuse-leap-16-1 opensuse-tumbleweed
1829 #, no-wrap
1830 msgid "scope, lexical closure lexical lexical scope subroutine, nested sub, nested subroutine, local sub, local"
1831 msgstr "domeniu, închidere lexicală, subrutină lexicală, subrutină imbricată, subrutină locală, local"
1832
1833 #. type: Plain text
1834 #: debian-trixie debian-unstable
1835 msgid ""
1836 "As explained above, an anonymous function with access to the lexical "
1837 "variables visible when that function was compiled, creates a closure. It "
1838 "retains access to those variables even though it doesn't get run until "
1839 "later, such as in a signal handler or a Tk callback."
1840 msgstr ""
1841
1842 #. type: Plain text
1843 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1844 #: opensuse-leap-16-1 opensuse-tumbleweed
1845 msgid ""
1846 "Using a closure as a function template allows us to generate many functions "
1847 "that act similarly. Suppose you wanted functions named after the colors "
1848 "that generated HTML font changes for the various colors:"
1849 msgstr ""
1850
1851 #. type: Plain text
1852 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1853 #: opensuse-leap-16-1 opensuse-tumbleweed
1854 #, no-wrap
1855 msgid "\\& print \"Be \", red(\"careful\"), \"with that \", green(\"light\");\n"
1856 msgstr "\\& print \"Fii \", red(\"atent\"), \"cu această \", green(\"lumină\");\n"
1857
1858 #. type: Plain text
1859 #: debian-trixie debian-unstable
1860 msgid ""
1861 "The B<red()> and B<green()> functions would be similar. To create these, "
1862 "we'll assign a closure to a typeglob of the name of the function we're "
1863 "trying to build."
1864 msgstr ""
1865 "Funcțiile B<red()> și B<green()> ar fi similare. Pentru a le crea, vom "
1866 "atribui o închidere unui „typeglob” cu numele funcției pe care încercăm să o "
1867 "construim."
1868
1869 #. type: Plain text
1870 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1871 #: opensuse-leap-16-1 opensuse-tumbleweed
1872 #, no-wrap
1873 msgid ""
1874 "\\& @colors = qw(red blue green yellow orange purple violet);\n"
1875 "\\& for my $name (@colors) {\n"
1876 "\\& no strict \\*(Aqrefs\\*(Aq; # allow symbol table manipulation\n"
1877 "\\& *$name = *{uc $name} = sub { \"E<lt>FONT COLOR=\\*(Aq$name\\*(AqE<gt>@_E<lt>/FONTE<gt>\" };\n"
1878 "\\& }\n"
1879 msgstr ""
1880 "\\& @colors = qw(red blue green yellow orange purple violet);\n"
1881 "\\& for my $name (@colors) {\n"
1882 "\\& no strict \\*(Aqrefs\\*(Aq; # permite manipularea tabelului de simboluri\n"
1883 "\\& *$name = *{uc $name} = sub { \"E<lt>FONT COLOR=\\*(Aq$name\\*(AqE<gt>@_E<lt>/FONTE<gt>\" };\n"
1884 "\\& }\n"
1885
1886 #. type: Plain text
1887 #: debian-trixie debian-unstable
1888 msgid ""
1889 "Now all those different functions appear to exist independently. You can "
1890 "call B<red()>, B<RED()>, B<blue()>, B<BLUE()>, B<green()>, etc. This "
1891 "technique saves on both compile time and memory use, and is less error-prone "
1892 "as well, since syntax checks happen at compile time. It's critical that any "
1893 "variables in the anonymous subroutine be lexicals in order to create a "
1894 "proper closure. That's the reasons for the CW<\\*(C`my\\*(C'> on the loop "
1895 "iteration variable."
1896 msgstr ""
1897
1898 #. type: Plain text
1899 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1900 #: opensuse-leap-16-1 opensuse-tumbleweed
1901 msgid ""
1902 "This is one of the only places where giving a prototype to a closure makes "
1903 "much sense. If you wanted to impose scalar context on the arguments of "
1904 "these functions (probably not a wise idea for this particular example), you "
1905 "could have written it this way instead:"
1906 msgstr ""
1907
1908 #. type: Plain text
1909 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1910 #: opensuse-leap-16-1 opensuse-tumbleweed
1911 #, no-wrap
1912 msgid "\\& *$name = sub ($) { \"E<lt>FONT COLOR=\\*(Aq$name\\*(AqE<gt>$_[0]E<lt>/FONTE<gt>\" };\n"
1913 msgstr "\\& *$name = sub ($) { \"E<lt>FONT COLOR=\\*(Aq$name\\*(AqE<gt>$_[0]E<lt>/FONTE<gt>\" };\n"
1914
1915 #. type: Plain text
1916 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1917 #: opensuse-leap-16-1 opensuse-tumbleweed
1918 msgid ""
1919 "However, since prototype checking happens at compile time, the assignment "
1920 "above happens too late to be of much use. You could address this by putting "
1921 "the whole loop of assignments within a BEGIN block, forcing it to occur "
1922 "during compilation."
1923 msgstr ""
1924
1925 #. type: Plain text
1926 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1927 #: opensuse-leap-16-1 opensuse-tumbleweed
1928 msgid ""
1929 "Access to lexicals that change over time--like those in the "
1930 "CW<\\*(C`for\\*(C'> loop above, basically aliases to elements from the "
1931 "surrounding lexical scopes-- only works with anonymous subs, not with named "
1932 "subroutines. Generally said, named subroutines do not nest properly and "
1933 "should only be declared in the main package scope."
1934 msgstr ""
1935
1936 #. type: Plain text
1937 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1938 #: opensuse-leap-16-1 opensuse-tumbleweed
1939 msgid ""
1940 "This is because named subroutines are created at compile time so their "
1941 "lexical variables get assigned to the parent lexicals from the first "
1942 "execution of the parent block. If a parent scope is entered a second time, "
1943 "its lexicals are created again, while the nested subs still reference the "
1944 "old ones."
1945 msgstr ""
1946
1947 #. type: Plain text
1948 #: debian-trixie debian-unstable
1949 msgid ""
1950 "Anonymous subroutines get to capture each time you execute the "
1951 "CW<\\*(C`sub\\*(C'> operator, as they are created on the fly. If you are "
1952 "accustomed to using nested subroutines in other programming languages with "
1953 "their own private variables, you'll have to work at it a bit in Perl. The "
1954 "intuitive coding of this type of thing incurs mysterious warnings about "
1955 "\"will not stay shared\" due to the reasons explained above. For example, "
1956 "this won't work:"
1957 msgstr ""
1958
1959 #. type: Plain text
1960 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1961 #: opensuse-leap-16-1 opensuse-tumbleweed
1962 #, no-wrap
1963 msgid ""
1964 "\\& sub outer {\n"
1965 "\\& my $x = $_[0] + 35;\n"
1966 "\\& sub inner { return $x * 19 } # WRONG\n"
1967 "\\& return $x + inner();\n"
1968 "\\& }\n"
1969 msgstr ""
1970 "\\& sub outer {\n"
1971 "\\& my $x = $_[0] + 35;\n"
1972 "\\& sub inner { return $x * 19 } # GREȘIT\n"
1973 "\\& return $x + inner();\n"
1974 "\\& }\n"
1975
1976 #. type: Plain text
1977 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1978 #: opensuse-leap-16-1 opensuse-tumbleweed
1979 msgid "A work-around is the following:"
1980 msgstr "O soluție alternativă este următoarea:"
1981
1982 #. type: Plain text
1983 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1984 #: opensuse-leap-16-1 opensuse-tumbleweed
1985 #, no-wrap
1986 msgid ""
1987 "\\& sub outer {\n"
1988 "\\& my $x = $_[0] + 35;\n"
1989 "\\& local *inner = sub { return $x * 19 };\n"
1990 "\\& return $x + inner();\n"
1991 "\\& }\n"
1992 msgstr ""
1993 "\\& sub outer {\n"
1994 "\\& my $x = $_[0] + 35;\n"
1995 "\\& local *inner = sub { return $x * 19 };\n"
1996 "\\& return $x + inner();\n"
1997 "\\& }\n"
1998
1999 #. type: Plain text
2000 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2001 #: opensuse-leap-16-1 opensuse-tumbleweed
2002 msgid ""
2003 "Now B<inner()> can only be called from within B<outer()>, because of the "
2004 "temporary assignments of the anonymous subroutine. But when it does, it has "
2005 "normal access to the lexical variable CW<$x> from the scope of \\&B<outer()> "
2006 "at the time outer is invoked."
2007 msgstr ""
2008
2009 #. type: Plain text
2010 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2011 #: opensuse-leap-16-1 opensuse-tumbleweed
2012 msgid ""
2013 "This has the interesting effect of creating a function local to another "
2014 "function, something not normally supported in Perl."
2015 msgstr ""
2016 "Acest lucru are ca efect interesant crearea unei funcții locale în cadrul "
2017 "unei alte funcții, lucru care, în mod normal, nu este acceptat în Perl."
2018
2019 #. type: IX
2020 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2021 #: opensuse-leap-16-1 opensuse-tumbleweed
2022 #, no-wrap
2023 msgid "Postfix Dereference Syntax"
2024 msgstr "Sintaxa de dereferențiere „postfix”"
2025
2026 #. type: Plain text
2027 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2028 #: opensuse-leap-16-1 opensuse-tumbleweed
2029 msgid ""
2030 "Beginning in v5.20.0, a postfix syntax for using references is available. "
2031 "It behaves as described in \"Using References\", but instead of a prefixed "
2032 "sigil, a postfixed sigil-and-star is used."
2033 msgstr ""
2034
2035 #. type: Plain text
2036 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2037 #: opensuse-leap-16-1 opensuse-tumbleweed
2038 msgid "For example:"
2039 msgstr "De exemplu:"
2040
2041 #. type: Plain text
2042 #: debian-trixie debian-unstable
2043 #, no-wrap
2044 msgid ""
2045 "\\& $r = \\e@a;\n"
2046 "\\& @b = $r-E<gt>@*; # equivalent to @$r or @{ $r }\n"
2047 "\\&\n"
2048 "\\& $r = [ 1, [ 2, 3 ], 4 ];\n"
2049 "\\& $r-E<gt>[1]-E<gt>@*; # equivalent to @{ $r-E<gt>[1] }\n"
2050 msgstr ""
2051 "\\& $r = \\e@a;\n"
2052 "\\& @b = $r-E<gt>@*; # echivalent cu @$r or @{ $r }\n"
2053 "\\&\n"
2054 "\\& $r = [ 1, [ 2, 3 ], 4 ];\n"
2055 "\\& $r-E<gt>[1]-E<gt>@*; # echivalent cu @{ $r-E<gt>[1] }\n"
2056
2057 #. type: Plain text
2058 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2059 #: opensuse-leap-16-1 opensuse-tumbleweed
2060 msgid ""
2061 "In Perl 5.20 and 5.22, this syntax must be enabled with CW<use feature "
2062 "\\&\\*(Aqpostderef\\*(Aq>. As of Perl 5.24, no feature declarations are "
2063 "required to make it available."
2064 msgstr ""
2065 "În Perl 5.20 și 5.22, această sintaxă trebuie activată cu CW<use feature "
2066 "\\&\\*(Aqpostderef\\*(Aq>. Începând cu Perl 5.24, nu mai sunt necesare "
2067 "declarații de funcții pentru a o face disponibilă."
2068
2069 #. type: Plain text
2070 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2071 #: opensuse-leap-16-1 opensuse-tumbleweed
2072 msgid ""
2073 "Postfix dereference should work in all circumstances where block (circumfix) "
2074 "dereference worked, and should be entirely equivalent. This syntax allows "
2075 "dereferencing to be written and read entirely left-to-right. The following "
2076 "equivalencies are defined:"
2077 msgstr ""
2078
2079 #. type: Plain text
2080 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2081 #: opensuse-leap-16-1 opensuse-tumbleweed
2082 #, no-wrap
2083 msgid ""
2084 "\\& $sref-E<gt>$*; # same as ${ $sref }\n"
2085 "\\& $aref-E<gt>@*; # same as @{ $aref }\n"
2086 "\\& $aref-E<gt>$#*; # same as $#{ $aref }\n"
2087 "\\& $href-E<gt>%*; # same as %{ $href }\n"
2088 "\\& $cref-E<gt>&*; # same as &{ $cref }\n"
2089 "\\& $gref-E<gt>**; # same as *{ $gref }\n"
2090 msgstr ""
2091 "\\& $sref-E<gt>$*; # la fel cu ${ $sref }\n"
2092 "\\& $aref-E<gt>@*; # la fel cu @{ $aref }\n"
2093 "\\& $aref-E<gt>$#*; # la fel cu $#{ $aref }\n"
2094 "\\& $href-E<gt>%*; # la fel cu %{ $href }\n"
2095 "\\& $cref-E<gt>&*; # la fel cu &{ $cref }\n"
2096 "\\& $gref-E<gt>**; # la fel cu *{ $gref }\n"
2097
2098 #. type: Plain text
2099 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2100 #: opensuse-leap-16-1 opensuse-tumbleweed
2101 msgid ""
2102 "Note especially that CW<\\*(C`$cref-E<gt>&*\\*(C'> is I<not> equivalent to "
2103 "CW<$cref-E<gt>()>, and can serve different purposes."
2104 msgstr ""
2105 "Rețineți în special că CW<\\*(C`$cref-E<gt>&*\\*(C'> nu este echivalent cu "
2106 "CW<$cref-E<gt>()> și poate servi unor scopuri diferite."
2107
2108 #. type: Plain text
2109 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2110 #: opensuse-leap-16-1 opensuse-tumbleweed
2111 msgid ""
2112 "Glob elements can be extracted through the postfix dereferencing feature:"
2113 msgstr ""
2114 "Elementele globale pot fi extrase prin intermediul funcției de de-"
2115 "referențiere „postfix”:"
2116
2117 #. type: Plain text
2118 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2119 #: opensuse-leap-16-1 opensuse-tumbleweed
2120 #, no-wrap
2121 msgid "\\& $gref-E<gt>*{SCALAR}; # same as *{ $gref }{SCALAR}\n"
2122 msgstr "\\& $gref-E<gt>*{SCALAR}; # la fel cu *{ $gref }{SCALAR}\n"
2123
2124 #. type: Plain text
2125 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2126 #: opensuse-leap-16-1 opensuse-tumbleweed
2127 msgid ""
2128 "Postfix array and scalar dereferencing I<can> be used in interpolating "
2129 "strings (double quotes or the CW<\\*(C`qq\\*(C'> operator), but only if the "
2130 "\\&CW<\\*(C`postderef_qq\\*(C'> feature is enabled. Interpolation of postfix "
2131 "array highest index access (CW<\\*(C`-E<gt>$#*\\*(C'>) is also supported "
2132 "when the CW<\\*(C`postderef_qq\\*(C'> feature is enabled."
2133 msgstr ""
2134
2135 #. type: IX
2136 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2137 #: opensuse-leap-16-1 opensuse-tumbleweed
2138 #, no-wrap
2139 msgid "Postfix Reference Slicing"
2140 msgstr "Segmentarea referințelor „postfix”"
2141
2142 #. type: Plain text
2143 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2144 #: opensuse-leap-16-1 opensuse-tumbleweed
2145 msgid ""
2146 "Value slices of arrays and hashes may also be taken with postfix "
2147 "dereferencing notation, with the following equivalencies:"
2148 msgstr ""
2149 "Valorile fragmentelor din matrici și hash-uri pot fi, de asemenea, extrase "
2150 "folosind notația de de-referențiere „postfix”, conform următoarelor "
2151 "echivalențe:"
2152
2153 #. type: Plain text
2154 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2155 #: opensuse-leap-16-1 opensuse-tumbleweed
2156 #, no-wrap
2157 msgid ""
2158 "\\& $aref-E<gt>@[ ... ]; # same as @$aref[ ... ]\n"
2159 "\\& $href-E<gt>@{ ... }; # same as @$href{ ... }\n"
2160 msgstr ""
2161 "\\& $aref-E<gt>@[ ... ]; # la fel cu @$aref[ ... ]\n"
2162 "\\& $href-E<gt>@{ ... }; # la fel cu @$href{ ... }\n"
2163
2164 #. type: Plain text
2165 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2166 #: opensuse-leap-16-1 opensuse-tumbleweed
2167 msgid ""
2168 "Postfix key/value pair slicing, added in 5.20.0 and documented in the Key/"
2169 "Value Hash Slices section of perldata, also behaves as expected:"
2170 msgstr ""
2171 "Segmentarea perechilor cheie/valoare postfix, introdusă în versiunea 5.20.0 "
2172 "și documentată în secțiunea „Key/Value Hash Slices” (Segmente hash cheie/"
2173 "valoare) din perldata, se comportă, de asemenea, conform așteptărilor:"
2174
2175 #. type: Plain text
2176 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2177 #: opensuse-leap-16-1 opensuse-tumbleweed
2178 #, no-wrap
2179 msgid ""
2180 "\\& $aref-E<gt>%[ ... ]; # same as %$aref[ ... ]\n"
2181 "\\& $href-E<gt>%{ ... }; # same as %$href{ ... }\n"
2182 msgstr ""
2183 "\\& $aref-E<gt>%[ ... ]; # la fel cu %$aref[ ... ]\n"
2184 "\\& $href-E<gt>%{ ... }; # la fel cu %$href{ ... }\n"
2185
2186 #. type: Plain text
2187 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2188 #: opensuse-leap-16-1 opensuse-tumbleweed
2189 msgid ""
2190 "As with postfix array, postfix value slice dereferencing I<can> be used in "
2191 "interpolating strings (double quotes or the CW<\\*(C`qq\\*(C'> operator), "
2192 "but only if the CW<\\*(C`postderef_qq\\*(C'> feature is enabled."
2193 msgstr ""
2194
2195 #. type: IX
2196 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2197 #: opensuse-leap-16-1 opensuse-tumbleweed
2198 #, no-wrap
2199 msgid "Assigning to References"
2200 msgstr "Atribuirea referințelor"
2201
2202 #. type: Plain text
2203 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2204 #: opensuse-leap-16-1 opensuse-tumbleweed
2205 msgid ""
2206 "Beginning in v5.22.0, the referencing operator can be assigned to. It "
2207 "performs an aliasing operation, so that the variable name referenced on the "
2208 "left-hand side becomes an alias for the thing referenced on the right-hand "
2209 "side:"
2210 msgstr ""
2211 "Începând cu versiunea 5.22.0, operatorul de referință poate fi atribuit. "
2212 "Acesta efectuează o operație de atribuire de alias, astfel încât numele "
2213 "variabilei menționate în partea stângă devine un alias pentru elementul "
2214 "menționat în partea dreaptă:"
2215
2216 #. type: Plain text
2217 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2218 #: opensuse-leap-16-1 opensuse-tumbleweed
2219 #, no-wrap
2220 msgid ""
2221 "\\& \\e$x = \\e$y; # $x and $y now point to the same scalar\n"
2222 "\\& \\e&foo = \\e&bar; # foo() now means bar()\n"
2223 msgstr ""
2224 "\\& \\e$x = \\e$y; # $x și $y acum indică același scalarr\n"
2225 "\\& \\e&foo = \\e&bar; # foo() înseamnă acum bar()\n"
2226
2227 #. type: Plain text
2228 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2229 #: opensuse-leap-16-1 opensuse-tumbleweed
2230 msgid ""
2231 "This syntax must be enabled with CW<\\*(C`use feature "
2232 "\\*(Aqrefaliasing\\*(Aq\\*(C'>. It is experimental, and will warn by "
2233 "default unless CW<no warnings \\&\\*(Aqexperimental::refaliasing\\*(Aq> is "
2234 "in effect."
2235 msgstr ""
2236
2237 #. type: Plain text
2238 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2239 #: opensuse-leap-16-1 opensuse-tumbleweed
2240 msgid ""
2241 "These forms may be assigned to, and cause the right-hand side to be "
2242 "evaluated in scalar context:"
2243 msgstr ""
2244 "Aceste forme pot fi atribuite și pot determina evaluarea părții din dreapta "
2245 "într-un context scalar:"
2246
2247 #. type: Plain text
2248 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2249 #: opensuse-leap-16-1 opensuse-tumbleweed
2250 #, no-wrap
2251 msgid ""
2252 "\\& \\e$scalar\n"
2253 "\\& \\e@array\n"
2254 "\\& \\e%hash\n"
2255 "\\& \\e&sub\n"
2256 "\\& \\emy $scalar\n"
2257 "\\& \\emy @array\n"
2258 "\\& \\emy %hash\n"
2259 "\\& \\estate $scalar # or @array, etc.\n"
2260 "\\& \\eour $scalar # etc.\n"
2261 "\\& \\elocal $scalar # etc.\n"
2262 "\\& \\elocal our $scalar # etc.\n"
2263 "\\& \\e$some_array[$index]\n"
2264 "\\& \\e$some_hash{$key}\n"
2265 "\\& \\elocal $some_array[$index]\n"
2266 "\\& \\elocal $some_hash{$key}\n"
2267 "\\& condition ? \\e$this : \\e$that[0] # etc.\n"
2268 msgstr ""
2269 "\\& \\e$scalar\n"
2270 "\\& \\e@array\n"
2271 "\\& \\e%hash\n"
2272 "\\& \\e&sub\n"
2273 "\\& \\emy $scalar\n"
2274 "\\& \\emy @array\n"
2275 "\\& \\emy %hash\n"
2276 "\\& \\estate $scalar # sau @array, etc.\n"
2277 "\\& \\eour $scalar # etc.\n"
2278 "\\& \\elocal $scalar # etc.\n"
2279 "\\& \\elocal our $scalar # etc.\n"
2280 "\\& \\e$some_array[$index]\n"
2281 "\\& \\e$some_hash{$key}\n"
2282 "\\& \\elocal $some_array[$index]\n"
2283 "\\& \\elocal $some_hash{$key}\n"
2284 "\\& condition ? \\e$this : \\e$that[0] # etc.\n"
2285
2286 #. type: Plain text
2287 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2288 #: opensuse-leap-16-1 opensuse-tumbleweed
2289 msgid ""
2290 "Slicing operations and parentheses cause the right-hand side to be evaluated "
2291 "in list context:"
2292 msgstr ""
2293 "Operațiile de segmentare și parantezele determină evaluarea părții din "
2294 "dreapta în context de listă:"
2295
2296 #. type: Plain text
2297 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2298 #: opensuse-leap-16-1 opensuse-tumbleweed
2299 #, no-wrap
2300 msgid ""
2301 "\\& \\e@array[5..7]\n"
2302 "\\& (\\e@array[5..7])\n"
2303 "\\& \\e(@array[5..7])\n"
2304 "\\& \\e@hash{\\*(Aqfoo\\*(Aq,\\*(Aqbar\\*(Aq}\n"
2305 "\\& (\\e@hash{\\*(Aqfoo\\*(Aq,\\*(Aqbar\\*(Aq})\n"
2306 "\\& \\e(@hash{\\*(Aqfoo\\*(Aq,\\*(Aqbar\\*(Aq})\n"
2307 "\\& (\\e$scalar)\n"
2308 "\\& \\e($scalar)\n"
2309 "\\& \\e(my $scalar)\n"
2310 "\\& \\emy($scalar)\n"
2311 "\\& (\\e@array)\n"
2312 "\\& (\\e%hash)\n"
2313 "\\& (\\e&sub)\n"
2314 "\\& \\e(&sub)\n"
2315 "\\& \\e($foo, @bar, %baz)\n"
2316 "\\& (\\e$foo, \\e@bar, \\e%baz)\n"
2317 msgstr ""
2318 "\\& \\e@array[5..7]\n"
2319 "\\& (\\e@array[5..7])\n"
2320 "\\& \\e(@array[5..7])\n"
2321 "\\& \\e@hash{\\*(Aqfoo\\*(Aq,\\*(Aqbar\\*(Aq}\n"
2322 "\\& (\\e@hash{\\*(Aqfoo\\*(Aq,\\*(Aqbar\\*(Aq})\n"
2323 "\\& \\e(@hash{\\*(Aqfoo\\*(Aq,\\*(Aqbar\\*(Aq})\n"
2324 "\\& (\\e$scalar)\n"
2325 "\\& \\e($scalar)\n"
2326 "\\& \\e(my $scalar)\n"
2327 "\\& \\emy($scalar)\n"
2328 "\\& (\\e@array)\n"
2329 "\\& (\\e%hash)\n"
2330 "\\& (\\e&sub)\n"
2331 "\\& \\e(&sub)\n"
2332 "\\& \\e($foo, @bar, %baz)\n"
2333 "\\& (\\e$foo, \\e@bar, \\e%baz)\n"
2334
2335 #. type: Plain text
2336 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2337 #: opensuse-leap-16-1 opensuse-tumbleweed
2338 msgid ""
2339 "Each element on the right-hand side must be a reference to a datum of the "
2340 "right type. Parentheses immediately surrounding an array (and possibly also "
2341 "CW<\\*(C`my\\*(C'>/CW<\\*(C`state\\*(C'>/CW<\\*(C`our\\*(C'>/"
2342 "CW<\\*(C`local\\*(C'>) will make each element of the array an alias to the "
2343 "corresponding scalar referenced on the right-hand side:"
2344 msgstr ""
2345
2346 #. type: Plain text
2347 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2348 #: opensuse-leap-16-1 opensuse-tumbleweed
2349 #, no-wrap
2350 msgid ""
2351 "\\& \\e(@x) = \\e(@y); # @x and @y now have the same elements\n"
2352 "\\& \\emy(@x) = \\e(@y); # likewise\n"
2353 "\\& \\e(my @x) = \\e(@y); # likewise\n"
2354 "\\& push @x, 3; # but now @x has an extra element that @y lacks\n"
2355 "\\& \\e(@x) = (\\e$x, \\e$y, \\e$z); # @x now contains $x, $y, and $z\n"
2356 msgstr ""
2357 "\\& \\e(@x) = \\e(@y); # @x și @y conțin acum aceleași elemente\n"
2358 "\\& \\emy(@x) = \\e(@y); # la fel\n"
2359 "\\& \\e(my @x) = \\e(@y); # la fel\n"
2360 "\\& push @x, 3; # dar acum @x are un element în plus pe care @y nu îl are\n"
2361 "\\& \\e(@x) = (\\e$x, \\e$y, \\e$z); # @x conține acum $x, $y și $z\n"
2362
2363 #. type: Plain text
2364 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2365 #: opensuse-leap-16-1 opensuse-tumbleweed
2366 msgid ""
2367 "Combining that form with CW<\\*(C`local\\*(C'> and putting parentheses "
2368 "immediately around a hash are forbidden (because it is not clear what they "
2369 "should do):"
2370 msgstr ""
2371
2372 #. type: Plain text
2373 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2374 #: opensuse-leap-16-1 opensuse-tumbleweed
2375 #, no-wrap
2376 msgid ""
2377 "\\& \\elocal(@array) = foo(); # WRONG\n"
2378 "\\& \\e(%hash) = bar(); # WRONG\n"
2379 msgstr ""
2380 "\\& \\elocal(@array) = foo(); # GREȘIT\n"
2381 "\\& \\e(%hash) = bar(); # GREȘIT\n"
2382
2383 #. type: Plain text
2384 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2385 #: opensuse-leap-16-1 opensuse-tumbleweed
2386 msgid ""
2387 "Assignment to references and non-references may be combined in lists and "
2388 "conditional ternary expressions, as long as the values on the right-hand "
2389 "side are the right type for each element on the left, though this may make "
2390 "for obfuscated code:"
2391 msgstr ""
2392
2393 #. type: Plain text
2394 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2395 #: opensuse-leap-16-1 opensuse-tumbleweed
2396 #, no-wrap
2397 msgid ""
2398 "\\& (my $tom, \\emy $dick, \\emy @harry) = (\\e1, \\e2, [1..3]);\n"
2399 "\\& # $tom is now \\e1\n"
2400 "\\& # $dick is now 2 (read-only)\n"
2401 "\\& # @harry is (1,2,3)\n"
2402 "\\&\n"
2403 "\\& my $type = ref $thingy;\n"
2404 "\\& ($type ? $type eq \\*(AqARRAY\\*(Aq ? \\e@foo : \\e$bar : $baz) = $thingy;\n"
2405 msgstr ""
2406 "\\& (my $tom, \\emy $dick, \\emy @harry) = (\\e1, \\e2, [1..3]);\n"
2407 "\\& # $tom este acum \\e1\n"
2408 "\\& # $dick este acum 2 (numai-pentru-citire)\n"
2409 "\\& # @harry este (1,2,3)\n"
2410 "\\&\n"
2411 "\\& my $type = ref $thingy;\n"
2412 "\\& ($type ? $type eq \\*(AqARRAY\\*(Aq ? \\e@foo : \\e$bar : $baz) = $thingy;\n"
2413
2414 #. type: Plain text
2415 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2416 #: opensuse-leap-16-1 opensuse-tumbleweed
2417 msgid ""
2418 "A reference assignment in list context returns a list of references to each "
2419 "left-hand value. So for example"
2420 msgstr ""
2421
2422 #. type: Plain text
2423 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2424 #: opensuse-leap-16-1 opensuse-tumbleweed
2425 #, no-wrap
2426 msgid "\\& @b = ((\\e$l1, \\e$l2, \\e(@a)) = (\\e$r1, \\e$r2, $\\er3, \\e$4));\n"
2427 msgstr "\\& @b = ((\\e$l1, \\e$l2, \\e(@a)) = (\\e$r1, \\e$r2, $\\er3, \\e$4));\n"
2428
2429 #. type: Plain text
2430 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2431 #: opensuse-leap-16-1 opensuse-tumbleweed
2432 msgid "is equivalent to"
2433 msgstr "este echivalent cu"
2434
2435 #. type: Plain text
2436 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2437 #: opensuse-leap-16-1 opensuse-tumbleweed
2438 #, no-wrap
2439 msgid ""
2440 "\\& (\\e$l1, \\e$l2, \\e(@a)) = (\\e$r1, \\e$r2, $\\er3, \\e$4);\n"
2441 "\\& @b = (\\e$l1, \\e$l2, \\e$a[0], \\e$a[1]);\n"
2442 msgstr ""
2443 "\\& (\\e$l1, \\e$l2, \\e(@a)) = (\\e$r1, \\e$r2, $\\er3, \\e$4);\n"
2444 "\\& @b = (\\e$l1, \\e$l2, \\e$a[0], \\e$a[1]);\n"
2445
2446 #. type: Plain text
2447 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2448 #: opensuse-leap-16-1 opensuse-tumbleweed
2449 msgid ""
2450 "The CW<\\*(C`foreach\\*(C'> loop can also take a reference constructor for "
2451 "its loop variable, though the syntax is limited to one of the following, "
2452 "with an optional CW<\\*(C`my\\*(C'>, CW<\\*(C`state\\*(C'>, or "
2453 "CW<\\*(C`our\\*(C'> after the backslash:"
2454 msgstr ""
2455
2456 #. type: Plain text
2457 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2458 #: opensuse-leap-16-1 opensuse-tumbleweed
2459 #, no-wrap
2460 msgid ""
2461 "\\& \\e$s\n"
2462 "\\& \\e@a\n"
2463 "\\& \\e%h\n"
2464 "\\& \\e&c\n"
2465 msgstr ""
2466 "\\& \\e$s\n"
2467 "\\& \\e@a\n"
2468 "\\& \\e%h\n"
2469 "\\& \\e&c\n"
2470
2471 #. type: Plain text
2472 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2473 #: opensuse-leap-16-1 opensuse-tumbleweed
2474 msgid ""
2475 "No parentheses are permitted. This feature is particularly useful for "
2476 "arrays-of-arrays, or arrays-of-hashes:"
2477 msgstr ""
2478
2479 #. type: Plain text
2480 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2481 #: opensuse-leap-16-1 opensuse-tumbleweed
2482 #, no-wrap
2483 msgid ""
2484 "\\& foreach \\emy @a (@array_of_arrays) {\n"
2485 "\\& frobnicate($a[0], $a[-1]);\n"
2486 "\\& }\n"
2487 "\\&\n"
2488 "\\& foreach \\emy %h (@array_of_hashes) {\n"
2489 "\\& $h{gelastic}++ if $h{type} eq \\*(Aqfunny\\*(Aq;\n"
2490 "\\& }\n"
2491 msgstr ""
2492
2493 #. type: Plain text
2494 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2495 #: opensuse-leap-16-1 opensuse-tumbleweed
2496 msgid ""
2497 "\\&B<CAVEAT:> Aliasing does not work correctly with closures. If you try to "
2498 "alias lexical variables from an inner subroutine or CW<\\*(C`eval\\*(C'>, "
2499 "the aliasing will only be visible within that inner sub, and will not affect "
2500 "the outer subroutine where the variables are declared. This bizarre "
2501 "behavior is subject to change."
2502 msgstr ""
2503
2504 #. type: IX
2505 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2506 #: opensuse-leap-16-1 opensuse-tumbleweed
2507 #, no-wrap
2508 msgid "Declaring a Reference to a Variable"
2509 msgstr ""
2510
2511 #. type: Plain text
2512 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2513 #: opensuse-leap-16-1 opensuse-tumbleweed
2514 msgid ""
2515 "Beginning in v5.26.0, the referencing operator can come after "
2516 "CW<\\*(C`my\\*(C'>, \\&CW<\\*(C`state\\*(C'>, CW<\\*(C`our\\*(C'>, or "
2517 "CW<\\*(C`local\\*(C'>. This syntax must be enabled with CW<\\*(C`use "
2518 "feature \\*(Aqdeclared_refs\\*(Aq\\*(C'>. It is experimental, and will warn "
2519 "by default unless CW<\\*(C`no warnings "
2520 "\\*(Aqexperimental::refaliasing\\*(Aq\\*(C'> is in effect."
2521 msgstr ""
2522
2523 #. type: Plain text
2524 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2525 #: opensuse-leap-16-1 opensuse-tumbleweed
2526 msgid "This feature makes these:"
2527 msgstr ""
2528
2529 #. type: Plain text
2530 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2531 #: opensuse-leap-16-1 opensuse-tumbleweed
2532 #, no-wrap
2533 msgid ""
2534 "\\& my \\e$x;\n"
2535 "\\& our \\e$y;\n"
2536 msgstr ""
2537 "\\& my \\e$x;\n"
2538 "\\& our \\e$y;\n"
2539
2540 #. type: Plain text
2541 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2542 #: opensuse-leap-16-1 opensuse-tumbleweed
2543 msgid "equivalent to:"
2544 msgstr "echivalent cu:"
2545
2546 #. type: Plain text
2547 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2548 #: opensuse-leap-16-1 opensuse-tumbleweed
2549 #, no-wrap
2550 msgid ""
2551 "\\& \\emy $x;\n"
2552 "\\& \\eour $x;\n"
2553 msgstr ""
2554 "\\& \\emy $x;\n"
2555 "\\& \\eour $x;\n"
2556
2557 #. type: Plain text
2558 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2559 #: opensuse-leap-16-1 opensuse-tumbleweed
2560 msgid ""
2561 "It is intended mainly for use in assignments to references (see \"Assigning "
2562 "to References\", above). It also allows the backslash to be used on just "
2563 "some items in a list of declared variables:"
2564 msgstr ""
2565
2566 #. type: Plain text
2567 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2568 #: opensuse-leap-16-1 opensuse-tumbleweed
2569 #, no-wrap
2570 msgid "\\& my ($foo, \\e@bar, \\e%baz); # equivalent to: my $foo, \\emy(@bar, %baz);\n"
2571 msgstr "\\& my ($foo, \\e@bar, \\e%baz); # echivalent cu: my $foo, \\emy(@bar, %baz);\n"
2572
2573 #. type: IX
2574 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2575 #: opensuse-leap-16-1 opensuse-tumbleweed
2576 #, no-wrap
2577 msgid "WARNING: Don't use references as hash keys"
2578 msgstr ""
2579
2580 #. type: IX
2581 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2582 #: opensuse-leap-16-1 opensuse-tumbleweed
2583 #, no-wrap
2584 msgid "reference, string context reference, use as hash key"
2585 msgstr ""
2586
2587 #. type: Plain text
2588 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2589 #: opensuse-leap-16-1 opensuse-tumbleweed
2590 msgid ""
2591 "You may not (usefully) use a reference as the key to a hash. It will be "
2592 "converted into a string:"
2593 msgstr ""
2594
2595 #. type: Plain text
2596 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2597 #: opensuse-leap-16-1 opensuse-tumbleweed
2598 #, no-wrap
2599 msgid "\\& $x{ \\e$x } = $x;\n"
2600 msgstr "\\& $x{ \\e$x } = $x;\n"
2601
2602 #. type: Plain text
2603 #: debian-trixie debian-unstable
2604 msgid ""
2605 "If you try to dereference the key, it won't do a hard dereference, and you "
2606 "won't accomplish what you're attempting. You might want to do something "
2607 "more like"
2608 msgstr ""
2609
2610 #. type: Plain text
2611 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2612 #: opensuse-leap-16-1 opensuse-tumbleweed
2613 #, no-wrap
2614 msgid ""
2615 "\\& $r = \\e@a;\n"
2616 "\\& $x{ $r } = $r;\n"
2617 msgstr ""
2618 "\\& $r = \\e@a;\n"
2619 "\\& $x{ $r } = $r;\n"
2620
2621 #. type: Plain text
2622 #: debian-trixie debian-unstable
2623 msgid ""
2624 "And then at least you can use the B<values()>, which will be real refs, "
2625 "instead of the B<keys()>, which won't."
2626 msgstr ""
2627
2628 #. type: Plain text
2629 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2630 #: opensuse-leap-16-1 opensuse-tumbleweed
2631 msgid ""
2632 "The standard Tie::RefHash module provides a convenient workaround to this."
2633 msgstr ""
2634
2635 #. type: IX
2636 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2637 #: opensuse-leap-16-1 opensuse-tumbleweed
2638 #, no-wrap
2639 msgid "SEE ALSO"
2640 msgstr "CONSULTAȚI ȘI"
2641
2642 #. type: Plain text
2643 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2644 #: opensuse-leap-16-1 opensuse-tumbleweed
2645 msgid ""
2646 "Besides the obvious documents, source code can be instructive. Some "
2647 "pathological examples of the use of references can be found in the I<t/op/"
2648 "ref.t> regression test in the Perl source directory."
2649 msgstr ""
2650
2651 #. type: Plain text
2652 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2653 #: opensuse-leap-16-1 opensuse-tumbleweed
2654 msgid ""
2655 "See also perldsc and perllol for how to use references to create complex "
2656 "data structures, and perlootut and perlobj for how to use them to create "
2657 "objects."
2658 msgstr ""
2659
2660 #. type: TH
2661 #: debian-unstable
2662 #, no-wrap
2663 msgid "2025-11-16"
2664 msgstr "16 noiembrie 2025"
2665
2666 #. type: TH
2667 #: fedora-44 opensuse-leap-16-1 opensuse-tumbleweed
2668 #, no-wrap
2669 msgid "2026-03-09"
2670 msgstr "9 martie 2026"
2671
2672 #. type: TH
2673 #: fedora-44 opensuse-leap-16-1 opensuse-tumbleweed
2674 #, no-wrap
2675 msgid "perl v5.42.1"
2676 msgstr "perl v5.42.1"
2677
2678 #. type: Plain text
2679 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
2680 #: opensuse-tumbleweed
2681 msgid ""
2682 "Symbolic references are names of variables or other objects, just as a "
2683 "symbolic link in a Unix filesystem contains merely the name of a file. The "
2684 "CW<*glob> notation is something of a symbolic reference. (Symbolic "
2685 "references are sometimes called \"soft references\", but please don\\*(Aqt "
2686 "call them that; references are confusing enough without useless synonyms.)"
2687 msgstr ""
2688
2689 #. type: Plain text
2690 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
2691 #: opensuse-tumbleweed
2692 msgid ""
2693 "References are easy to use in Perl. There is just one overriding principle: "
2694 "in general, Perl does no implicit referencing or dereferencing. When a "
2695 "scalar is holding a reference, it always behaves as a simple scalar. It "
2696 "doesn\\*(Aqt magically start being an array or hash or subroutine; you have "
2697 "to tell it explicitly to do so, by dereferencing it."
2698 msgstr ""
2699
2700 #. type: Plain text
2701 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
2702 #: opensuse-tumbleweed
2703 msgid ""
2704 "By using the backslash operator on a variable, subroutine, or value. (This "
2705 "works much like the & (address-of) operator in C.) This typically creates "
2706 "I<another> reference to a variable, because there\\*(Aqs already a reference "
2707 "to the variable in the symbol table. But the symbol table reference might "
2708 "go away, and you\\*(Aqll still have the reference that the backslash "
2709 "returned. Here are some examples:"
2710 msgstr ""
2711
2712 #. type: Plain text
2713 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
2714 #: opensuse-tumbleweed
2715 msgid ""
2716 "It isn\\*(Aqt possible to create a true reference to an IO handle "
2717 "(filehandle or dirhandle) using the backslash operator. The most you can "
2718 "get is a reference to a typeglob, which is actually a complete symbol table "
2719 "entry. But see the explanation of the CW<*foo{THING}> syntax below. "
2720 "However, you can still use type globs and globrefs as though they were IO "
2721 "handles."
2722 msgstr ""
2723
2724 #. type: Plain text
2725 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
2726 #: opensuse-tumbleweed
2727 msgid ""
2728 "Here we\\*(Aqve created a reference to an anonymous array of three elements "
2729 "whose final element is itself a reference to another anonymous array of "
2730 "three elements. (The multidimensional syntax described later can be used to "
2731 "access this. For example, after the above, CW<\\*(C`$arrayref-E<gt>[2]"
2732 "[1]\\*(C'> would have the value \"b\".)"
2733 msgstr ""
2734
2735 #. type: Plain text
2736 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
2737 #: opensuse-tumbleweed
2738 msgid ""
2739 "Taking a reference to an enumerated list is not the same as using square "
2740 "brackets--instead it\\*(Aqs the same as creating a list of references!"
2741 msgstr ""
2742
2743 #. type: Plain text
2744 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
2745 #: opensuse-tumbleweed
2746 msgid ""
2747 "Because curly brackets (braces) are used for several other things including "
2748 "BLOCKs, you may occasionally have to disambiguate braces at the beginning of "
2749 "a statement by putting a CW<\\*(C`+\\*(C'> or a CW<\\*(C`return\\*(C'> in "
2750 "front so that Perl realizes the opening brace isn\\*(Aqt starting a BLOCK. "
2751 "The economy and mnemonic value of using curlies is deemed worth this "
2752 "occasional extra hassle."
2753 msgstr ""
2754
2755 #. type: Plain text
2756 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
2757 #: opensuse-tumbleweed
2758 msgid ""
2759 "Note the semicolon. Except for the code inside not being immediately "
2760 "executed, a CW<\\*(C`sub {}\\*(C'> is not so much a declaration as it is an "
2761 "operator, like CW<\\*(C`do{}\\*(C'> or CW<\\*(C`eval{}\\*(C'>. (However, no "
2762 "matter how many times you execute that particular line (unless you\\*(Aqre "
2763 "in an \\&CW<eval(\"...\")>), CW<$coderef> will still have a reference to the "
2764 "I<same> anonymous subroutine.)"
2765 msgstr ""
2766
2767 #. type: Plain text
2768 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
2769 #: opensuse-tumbleweed
2770 msgid ""
2771 "Anonymous subroutines act as closures with respect to B<my()> variables, "
2772 "that is, variables lexically visible within the current scope. Closure is a "
2773 "notion out of the Lisp world that says if you define an anonymous function "
2774 "in a particular lexical context, it pretends to run in that context even "
2775 "when it\\*(Aqs called outside the context."
2776 msgstr ""
2777
2778 #. type: Plain text
2779 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
2780 #: opensuse-tumbleweed
2781 msgid ""
2782 "In human terms, it\\*(Aqs a funny way of passing arguments to a subroutine "
2783 "when you define it as well as when you call it. It\\*(Aqs useful for "
2784 "setting up little bits of code to run later, such as callbacks. You can "
2785 "even do object-oriented stuff with it, though Perl already provides a "
2786 "different mechanism to do that--see perlobj."
2787 msgstr ""
2788
2789 #. type: Plain text
2790 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
2791 #: opensuse-tumbleweed
2792 msgid ""
2793 "You might also think of closure as a way to write a subroutine template "
2794 "without using B<eval()>. Here\\*(Aqs a small example of how closures work:"
2795 msgstr ""
2796
2797 #. type: Plain text
2798 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
2799 #: opensuse-tumbleweed
2800 msgid ""
2801 "Note particularly that CW<$x> continues to refer to the value passed into "
2802 "B<newprint()> I<despite> \"my CW<$x>\" having gone out of scope by the time "
2803 "the anonymous subroutine runs. That\\*(Aqs what a closure is all about."
2804 msgstr ""
2805
2806 #. type: Plain text
2807 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
2808 #: opensuse-tumbleweed
2809 msgid ""
2810 "References are often returned by special subroutines called constructors. "
2811 "Perl objects are just references to a special type of object that happens to "
2812 "know which package it\\*(Aqs associated with. Constructors are just special "
2813 "subroutines that know how to create that association. They do so by "
2814 "starting with an ordinary reference, and it remains an ordinary reference "
2815 "even while it\\*(Aqs also being an object. Constructors are often named "
2816 "CW<new()>. You I<can> call them indirectly:"
2817 msgstr ""
2818
2819 #. type: Plain text
2820 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
2821 #: opensuse-tumbleweed
2822 msgid ""
2823 "But that can produce ambiguous syntax in certain cases, so it\\*(Aqs often "
2824 "better to use the direct method invocation approach:"
2825 msgstr ""
2826
2827 #. type: Plain text
2828 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
2829 #: opensuse-tumbleweed
2830 msgid ""
2831 "References of the appropriate type can spring into existence if you "
2832 "dereference them in a context that assumes they exist. Because we "
2833 "haven\\*(Aqt talked about dereferencing yet, we can\\*(Aqt show you any "
2834 "examples yet."
2835 msgstr ""
2836
2837 #. type: Plain text
2838 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
2839 #: opensuse-tumbleweed
2840 msgid ""
2841 "\\&CW<*foo{THING}> returns undef if that particular THING hasn\\*(Aqt been "
2842 "used yet, except in the case of scalars. CW<*foo{SCALAR}> returns a "
2843 "reference to an anonymous scalar if CW<$foo> hasn\\*(Aqt been used yet. "
2844 "This might change in a future release."
2845 msgstr ""
2846
2847 #. type: Plain text
2848 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
2849 #: opensuse-tumbleweed
2850 msgid ""
2851 "\\&CW<*foo{IO}> is an alternative to the CW<*HANDLE> mechanism given in "
2852 "\"Typeglobs and Filehandles\" in perldata for passing filehandles into or "
2853 "out of subroutines, or storing into larger data structures. Its "
2854 "disadvantage is that it won\\*(Aqt create a new filehandle for you. Its "
2855 "advantage is that you have less risk of clobbering more than you want to "
2856 "with a typeglob assignment. (It still conflates file and directory handles, "
2857 "though.) However, if you assign the incoming value to a scalar instead of a "
2858 "typeglob as we do in the examples below, there\\*(Aqs no risk of that "
2859 "happening."
2860 msgstr ""
2861
2862 #. type: Plain text
2863 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
2864 #: opensuse-tumbleweed
2865 msgid ""
2866 "That\\*(Aqs it for creating references. By now you\\*(Aqre probably dying "
2867 "to know how to use references to get back to your long-lost data. There are "
2868 "several basic methods."
2869 msgstr ""
2870
2871 #. type: Plain text
2872 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
2873 #: opensuse-tumbleweed
2874 msgid ""
2875 "Anywhere you\\*(Aqd put an identifier (or chain of identifiers) as part of a "
2876 "variable or subroutine name, you can replace the identifier with a simple "
2877 "scalar variable containing a reference of the correct type:"
2878 msgstr ""
2879
2880 #. type: Plain text
2881 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
2882 #: opensuse-tumbleweed
2883 msgid ""
2884 "It\\*(Aqs important to understand that we are specifically I<not> "
2885 "dereferencing \\&CW<$arrayref[0]> or CW<$hashref{\"KEY\"}> there. The "
2886 "dereference of the scalar variable happens I<before> it does any key "
2887 "lookups. Anything more complicated than a simple scalar variable must use "
2888 "methods 2 or 3 below. However, a \"simple scalar\" includes an identifier "
2889 "that itself uses method 1 recursively. Therefore, the following prints "
2890 "\"howdy\"."
2891 msgstr ""
2892
2893 #. type: Plain text
2894 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
2895 #: opensuse-tumbleweed
2896 msgid ""
2897 "Anywhere you\\*(Aqd put an identifier (or chain of identifiers) as part of a "
2898 "variable or subroutine name, you can replace the identifier with a BLOCK "
2899 "returning a reference of the correct type. In other words, the previous "
2900 "examples could be written like this:"
2901 msgstr ""
2902
2903 #. type: Plain text
2904 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
2905 #: opensuse-tumbleweed
2906 msgid ""
2907 "Admittedly, it\\*(Aqs a little silly to use the curlies in this case, but "
2908 "the BLOCK can contain any arbitrary expression, in particular, subscripted "
2909 "expressions:"
2910 msgstr ""
2911
2912 #. type: Plain text
2913 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
2914 #: opensuse-tumbleweed
2915 msgid ""
2916 "Because of being able to omit the curlies for the simple case of CW<$$x>, "
2917 "people often make the mistake of viewing the dereferencing symbols as proper "
2918 "operators, and wonder about their precedence. If they were, though, you "
2919 "could use parentheses instead of braces. That\\*(Aqs not the case. "
2920 "Consider the difference below; case 0 is a short-hand version of case 1, "
2921 "\\&I<not> case 2:"
2922 msgstr ""
2923
2924 #. type: Plain text
2925 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
2926 #: opensuse-tumbleweed
2927 msgid ""
2928 "Case 2 is also deceptive in that you\\*(Aqre accessing a variable called "
2929 "CW<%hashref>, not dereferencing through CW<$hashref> to the hash it\\*(Aqs "
2930 "presumably referencing. That would be case 3."
2931 msgstr ""
2932
2933 #. type: Plain text
2934 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
2935 #: opensuse-tumbleweed
2936 msgid ""
2937 "This is one of the cases we mentioned earlier in which references could "
2938 "spring into existence when in an lvalue context. Before this statement, "
2939 "CW<$array[$x]> may have been undefined. If so, it\\*(Aqs automatically "
2940 "defined with a hash reference so that we can look up \\&CW<\\*(C`{\"foo\"}"
2941 "\\*(C'> in it. Likewise CW<\\*(C`$array[$x]-E<gt>{\"foo\"}\\*(C'> will "
2942 "automatically get defined with an array reference so that we can look up "
2943 "CW<\\*(C`[0]\\*(C'> in it. This process is called I<autovivification>."
2944 msgstr ""
2945
2946 #. type: Plain text
2947 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
2948 #: opensuse-tumbleweed
2949 msgid ""
2950 "Which, in the degenerate case of using only ordinary arrays, gives you "
2951 "multidimensional arrays just like C\\*(Aqs:"
2952 msgstr ""
2953
2954 #. type: Plain text
2955 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
2956 #: opensuse-tumbleweed
2957 msgid ""
2958 "Well, okay, not entirely like C\\*(Aqs arrays, actually. C doesn\\*(Aqt "
2959 "know how to grow its arrays on demand. Perl does."
2960 msgstr ""
2961
2962 #. type: Plain text
2963 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
2964 #: opensuse-tumbleweed
2965 msgid ""
2966 "If a reference happens to be a reference to an object, then there are "
2967 "probably methods to access the things referred to, and you should probably "
2968 "stick to those methods unless you\\*(Aqre in the class package that defines "
2969 "the object\\*(Aqs methods. In other words, be nice, and don\\*(Aqt violate "
2970 "the object\\*(Aqs encapsulation without a very good reason. Perl does not "
2971 "enforce encapsulation. We are not totalitarians here. We do expect some "
2972 "basic civility though."
2973 msgstr ""
2974
2975 #. type: Plain text
2976 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
2977 #: opensuse-tumbleweed
2978 msgid ""
2979 "Using a reference as a string produces both its referent\\*(Aqs type, "
2980 "including any package blessing as described in perlobj, as well as the "
2981 "numeric address expressed in hex. The B<ref()> operator returns just the "
2982 "type of thing the reference is pointing to, without the address. See "
2983 "\"ref\" in perlfunc for details and examples of its use."
2984 msgstr ""
2985
2986 #. type: Plain text
2987 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
2988 #: opensuse-tumbleweed
2989 msgid "Here\\*(Aqs a trick for interpolating a subroutine call into a string:"
2990 msgstr ""
2991
2992 #. type: Plain text
2993 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
2994 #: opensuse-tumbleweed
2995 msgid ""
2996 "The way it works is that when the CW<\\*(C`@{...}\\*(C'> is seen in the "
2997 "double-quoted string, it\\*(Aqs evaluated as a block. The block creates a "
2998 "reference to an anonymous array containing the results of the call to "
2999 "CW<\\*(C`mysub(1,2,3)\\*(C'>. So the whole block returns a reference to an "
3000 "array, which is then dereferenced by CW<\\*(C`@{...}\\*(C'> and stuck into "
3001 "the double-quoted string. This chicanery is also useful for arbitrary "
3002 "expressions:"
3003 msgstr ""
3004
3005 #. type: Plain text
3006 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
3007 #: opensuse-tumbleweed
3008 msgid ""
3009 "Because objects in Perl are implemented as references, it\\*(Aqs possible to "
3010 "have circular references with objects as well. Imagine a TreeNode class "
3011 "where each node references its parent and child nodes. Any node with a "
3012 "parent will be part of a circular reference."
3013 msgstr ""
3014
3015 #. type: Plain text
3016 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
3017 #: opensuse-tumbleweed
3018 msgid "Here\\*(Aqs how we can make the first example safer:"
3019 msgstr ""
3020
3021 #. type: Plain text
3022 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
3023 #: opensuse-tumbleweed
3024 msgid ""
3025 "We said that references spring into existence as necessary if they are "
3026 "undefined, but we didn\\*(Aqt say what happens if a value used as a "
3027 "reference is already defined, but I<isn\\*(Aqt> a hard reference. If you "
3028 "use it as a reference, it\\*(Aqll be treated as a symbolic reference. That "
3029 "is, the value of the scalar is taken to be the I<name> of a variable, rather "
3030 "than a direct link to a (possibly) anonymous value."
3031 msgstr ""
3032
3033 #. type: Plain text
3034 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
3035 #: opensuse-tumbleweed
3036 msgid ""
3037 "This is powerful, and slightly dangerous, in that it\\*(Aqs possible to "
3038 "intend (with the utmost sincerity) to use a hard reference, and accidentally "
3039 "use a symbolic reference instead. To protect against that, you can say"
3040 msgstr ""
3041
3042 #. type: Plain text
3043 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
3044 #: opensuse-tumbleweed
3045 msgid ""
3046 "Only package variables (globals, even if localized) are visible to symbolic "
3047 "references. Lexical variables (declared with B<my()>) aren\\*(Aqt in a "
3048 "symbol table, and thus are invisible to this mechanism. For example:"
3049 msgstr ""
3050
3051 #. type: Plain text
3052 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
3053 #: opensuse-tumbleweed
3054 msgid ""
3055 "will have the same effect. This construct is I<not> considered to be a "
3056 "symbolic reference when you\\*(Aqre using strict refs:"
3057 msgstr ""
3058
3059 #. type: Plain text
3060 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
3061 #: opensuse-tumbleweed
3062 msgid ""
3063 "Pseudo-hashes have been removed from Perl. The fields pragma remains "
3064 "available."
3065 msgstr ""
3066
3067 #. type: Plain text
3068 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
3069 #: opensuse-tumbleweed
3070 msgid ""
3071 "As explained above, an anonymous function with access to the lexical "
3072 "variables visible when that function was compiled, creates a closure. It "
3073 "retains access to those variables even though it doesn\\*(Aqt get run until "
3074 "later, such as in a signal handler or a Tk callback."
3075 msgstr ""
3076
3077 #. type: Plain text
3078 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
3079 #: opensuse-tumbleweed
3080 msgid ""
3081 "The B<red()> and B<green()> functions would be similar. To create these, "
3082 "we\\*(Aqll assign a closure to a typeglob of the name of the function "
3083 "we\\*(Aqre trying to build."
3084 msgstr ""
3085
3086 #. type: Plain text
3087 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
3088 #: opensuse-tumbleweed
3089 msgid ""
3090 "Now all those different functions appear to exist independently. You can "
3091 "call B<red()>, B<RED()>, B<blue()>, B<BLUE()>, B<green()>, etc. This "
3092 "technique saves on both compile time and memory use, and is less error-prone "
3093 "as well, since syntax checks happen at compile time. It\\*(Aqs critical "
3094 "that any variables in the anonymous subroutine be lexicals in order to "
3095 "create a proper closure. That\\*(Aqs the reasons for the CW<\\*(C`my\\*(C'> "
3096 "on the loop iteration variable."
3097 msgstr ""
3098
3099 #. type: Plain text
3100 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
3101 #: opensuse-tumbleweed
3102 msgid ""
3103 "Anonymous subroutines get to capture each time you execute the "
3104 "CW<\\*(C`sub\\*(C'> operator, as they are created on the fly. If you are "
3105 "accustomed to using nested subroutines in other programming languages with "
3106 "their own private variables, you\\*(Aqll have to work at it a bit in Perl. "
3107 "The intuitive coding of this type of thing incurs mysterious warnings about "
3108 "\"will not stay shared\" due to the reasons explained above. For example, "
3109 "this won\\*(Aqt work:"
3110 msgstr ""
3111
3112 #. type: Plain text
3113 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
3114 #: opensuse-tumbleweed
3115 #, no-wrap
3116 msgid ""
3117 "\\& $r = \\e@a;\n"
3118 "\\& @b = $r-E<gt>@*; # equivalent to @$r or @{ $r }\n"
3119 "\\&\n"
3120 "\\& $r = [ 1, [ 2, 3 ], 4 ];\n"
3121 "\\& $r-E<gt>[1]-E<gt>@*; # equivalent to @{ $r-E<gt>[1] }\n"
3122 "\\&\n"
3123 "\\& $aref-E<gt>@* = (1, 2, 3); # same as @{ $aref } = (1, 2, 3)\n"
3124 msgstr ""
3125 "\\& $r = \\e@a;\n"
3126 "\\& @b = $r-E<gt>@*; # echivalent cu @$r sau @{ $r }\n"
3127 "\\&\n"
3128 "\\& $r = [ 1, [ 2, 3 ], 4 ];\n"
3129 "\\& $r-E<gt>[1]-E<gt>@*; # echivalent cu @{ $r-E<gt>[1] }\n"
3130 "\\&\n"
3131 "\\& $aref-E<gt>@* = (1, 2, 3); # la fel ca @{ $aref } = (1, 2, 3)\n"
3132
3133 #. type: SH
3134 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
3135 #: opensuse-tumbleweed
3136 #, no-wrap
3137 msgid "WARNING: Don\\*(Aqt use references as hash keys"
3138 msgstr ""
3139
3140 #. type: Plain text
3141 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
3142 #: opensuse-tumbleweed
3143 msgid ""
3144 "If you try to dereference the key, it won\\*(Aqt do a hard dereference, and "
3145 "you won\\*(Aqt accomplish what you\\*(Aqre attempting. You might want to do "
3146 "something more like"
3147 msgstr ""
3148
3149 #. type: Plain text
3150 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
3151 #: opensuse-tumbleweed
3152 msgid ""
3153 "And then at least you can use the B<values()>, which will be real refs, "
3154 "instead of the B<keys()>, which won\\*(Aqt."
3155 msgstr ""
3156
3157 #. type: TH
3158 #: fedora-rawhide
3159 #, no-wrap
3160 msgid "2026-03-30"
3161 msgstr "30 martie 2026"
3162
3163 #. type: TH
3164 #: fedora-rawhide
3165 #, no-wrap
3166 msgid "perl v5.42.2"
3167 msgstr "perl v5.42.2"
3168
3169 #. type: TH
3170 #: mageia-cauldron
3171 #, no-wrap
3172 msgid "2025-06-24"
3173 msgstr "24 iunie 2025"
3174
3175 #. type: TH
3176 #: mageia-cauldron
3177 #, no-wrap
3178 msgid "perl v5.42.0"
3179 msgstr "perl v5.42.0"