Debian Codegraph @

templates/man1/perldata.1.pot

raw
1 # SOME DESCRIPTIVE TITLE
2 # Copyright (C) YEAR Free Software Foundation, Inc.
3 # This file is distributed under the same license as the PACKAGE package.
4 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
5 #
6 #, fuzzy
7 msgid ""
8 msgstr ""
9 "Project-Id-Version: PACKAGE VERSION\n"
10 "POT-Creation-Date: 2026-06-05 06:34+0200\n"
11 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
12 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13 "Language-Team: LANGUAGE <[email protected]>\n"
14 "Language: \n"
15 "MIME-Version: 1.0\n"
16 "Content-Type: text/plain; charset=UTF-8\n"
17 "Content-Transfer-Encoding: 8bit\n"
18
19 # #-#-#-#-# fedora-44: perldata.1.pot (PACKAGE VERSION) #-#-#-#-#
20 #
21 # #-#-#-#-# fedora-rawhide: perldata.1.pot (PACKAGE VERSION) #-#-#-#-#
22 #
23 # #-#-#-#-# mageia-cauldron: perldata.1.pot (PACKAGE VERSION) #-#-#-#-#
24 #
25 # #-#-#-#-# opensuse-leap-16-1: perldata.1.pot (PACKAGE VERSION) #-#-#-#-#
26 #
27 # #-#-#-#-# opensuse-tumbleweed: perldata.1.pot (PACKAGE VERSION) #-#-#-#-#
28 #
29 #. #-#-#-#-# debian-trixie: perldata.1.pot (PACKAGE VERSION) #-#-#-#-#
30 #. ========================================================================
31 #. type: IX
32 #. #-#-#-#-# debian-unstable: perldata.1.pot (PACKAGE VERSION) #-#-#-#-#
33 #. ========================================================================
34 #. type: IX
35 #. #-#-#-#-# fedora-44: perldata.1.pot (PACKAGE VERSION) #-#-#-#-#
36 #. Required to disable full justification in groff 1.23.0.
37 #. ========================================================================
38 #. type: IX
39 #. #-#-#-#-# fedora-rawhide: perldata.1.pot (PACKAGE VERSION) #-#-#-#-#
40 #. Required to disable full justification in groff 1.23.0.
41 #. ========================================================================
42 #. type: IX
43 #. #-#-#-#-# mageia-cauldron: perldata.1.pot (PACKAGE VERSION) #-#-#-#-#
44 #. Required to disable full justification in groff 1.23.0.
45 #. ========================================================================
46 #. type: IX
47 #. #-#-#-#-# opensuse-leap-16-1: perldata.1.pot (PACKAGE VERSION) #-#-#-#-#
48 #. Required to disable full justification in groff 1.23.0.
49 #. ========================================================================
50 #. type: IX
51 #. #-#-#-#-# opensuse-tumbleweed: perldata.1.pot (PACKAGE VERSION) #-#-#-#-#
52 #. Required to disable full justification in groff 1.23.0.
53 #. ========================================================================
54 #. type: IX
55 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
56 #: opensuse-leap-16-1 opensuse-tumbleweed
57 #, no-wrap
58 msgid "Title"
59 msgstr ""
60
61 # #-#-#-#-# fedora-44: perldata.1.pot (PACKAGE VERSION) #-#-#-#-#
62 #
63 # #-#-#-#-# fedora-rawhide: perldata.1.pot (PACKAGE VERSION) #-#-#-#-#
64 #
65 # #-#-#-#-# mageia-cauldron: perldata.1.pot (PACKAGE VERSION) #-#-#-#-#
66 #
67 # #-#-#-#-# opensuse-leap-16-1: perldata.1.pot (PACKAGE VERSION) #-#-#-#-#
68 #
69 # #-#-#-#-# opensuse-tumbleweed: perldata.1.pot (PACKAGE VERSION) #-#-#-#-#
70 #
71 #. #-#-#-#-# debian-trixie: perldata.1.pot (PACKAGE VERSION) #-#-#-#-#
72 #. ========================================================================
73 #. type: IX
74 #. #-#-#-#-# debian-unstable: perldata.1.pot (PACKAGE VERSION) #-#-#-#-#
75 #. ========================================================================
76 #. type: IX
77 #. #-#-#-#-# fedora-44: perldata.1.pot (PACKAGE VERSION) #-#-#-#-#
78 #. Required to disable full justification in groff 1.23.0.
79 #. ========================================================================
80 #. type: IX
81 #. #-#-#-#-# fedora-rawhide: perldata.1.pot (PACKAGE VERSION) #-#-#-#-#
82 #. Required to disable full justification in groff 1.23.0.
83 #. ========================================================================
84 #. type: IX
85 #. #-#-#-#-# mageia-cauldron: perldata.1.pot (PACKAGE VERSION) #-#-#-#-#
86 #. Required to disable full justification in groff 1.23.0.
87 #. ========================================================================
88 #. type: IX
89 #. #-#-#-#-# opensuse-leap-16-1: perldata.1.pot (PACKAGE VERSION) #-#-#-#-#
90 #. Required to disable full justification in groff 1.23.0.
91 #. ========================================================================
92 #. type: IX
93 #. #-#-#-#-# opensuse-tumbleweed: perldata.1.pot (PACKAGE VERSION) #-#-#-#-#
94 #. Required to disable full justification in groff 1.23.0.
95 #. ========================================================================
96 #. type: IX
97 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
98 #: opensuse-leap-16-1 opensuse-tumbleweed
99 #, no-wrap
100 msgid "PERLDATA 1"
101 msgstr ""
102
103 #. type: TH
104 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
105 #: opensuse-leap-16-1 opensuse-tumbleweed
106 #, no-wrap
107 msgid "PERLDATA"
108 msgstr ""
109
110 #. type: TH
111 #: debian-trixie
112 #, no-wrap
113 msgid "2025-07-27"
114 msgstr ""
115
116 #. type: TH
117 #: debian-trixie debian-unstable
118 #, no-wrap
119 msgid "perl v5.40.1"
120 msgstr ""
121
122 #. type: TH
123 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
124 #: opensuse-leap-16-1 opensuse-tumbleweed
125 #, no-wrap
126 msgid "Perl Programmers Reference Guide"
127 msgstr ""
128
129 #. type: SH
130 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
131 #: opensuse-leap-16-1 opensuse-tumbleweed
132 #, no-wrap
133 msgid "NAME"
134 msgstr ""
135
136 #. type: Plain text
137 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
138 #: opensuse-leap-16-1 opensuse-tumbleweed
139 msgid "perldata - Perl data types"
140 msgstr ""
141
142 #. type: IX
143 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
144 #: opensuse-leap-16-1 opensuse-tumbleweed
145 #, no-wrap
146 msgid "DESCRIPTION"
147 msgstr ""
148
149 #. type: IX
150 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
151 #: opensuse-leap-16-1 opensuse-tumbleweed
152 #, no-wrap
153 msgid "Header"
154 msgstr ""
155
156 #. type: IX
157 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
158 #: opensuse-leap-16-1 opensuse-tumbleweed
159 #, no-wrap
160 msgid "Variable names"
161 msgstr ""
162
163 #. type: IX
164 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
165 #: opensuse-leap-16-1 opensuse-tumbleweed
166 #, no-wrap
167 msgid "Xref"
168 msgstr ""
169
170 #. type: IX
171 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
172 #: opensuse-leap-16-1 opensuse-tumbleweed
173 #, no-wrap
174 msgid "variable, name variable name data type type"
175 msgstr ""
176
177 #. type: IX
178 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
179 #: opensuse-leap-16-1 opensuse-tumbleweed
180 #, no-wrap
181 msgid "Subsection"
182 msgstr ""
183
184 #. type: Plain text
185 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
186 #: opensuse-leap-16-1 opensuse-tumbleweed
187 msgid ""
188 "Perl has three built-in data types: scalars, arrays of scalars, and "
189 "associative arrays of scalars, known as \"hashes\". A scalar is a single "
190 "string (of any size, limited only by the available memory), number, or a "
191 "reference to something (which will be discussed in perlref). Normal arrays "
192 "are ordered lists of scalars indexed by number, starting with 0. Hashes are "
193 "unordered collections of scalar values indexed by their associated string "
194 "key."
195 msgstr ""
196
197 #. type: Plain text
198 #: debian-trixie debian-unstable
199 msgid ""
200 "Values are usually referred to by name, or through a named reference. The "
201 "first character of the name tells you to what sort of data structure it "
202 "refers. The rest of the name tells you the particular value to which it "
203 "refers. Usually this name is a single I<identifier>, that is, a string "
204 "beginning with a letter or underscore, and containing letters, underscores, "
205 "and digits. In some cases, it may be a chain of identifiers, separated by "
206 "CW<\\*(C`::\\*(C'> (or by the deprecated CW<\\*(C`\\*(Aq\\*(C'>); all but "
207 "the last are interpreted as names of packages, to locate the namespace in "
208 "which to look up the final identifier (see \"Packages\" in perlmod for "
209 "details). For a more in-depth discussion on identifiers, see \"Identifier "
210 "parsing\". It's possible to substitute for a simple identifier, an "
211 "expression that produces a reference to the value at runtime. This is "
212 "described in more detail below and in perlref."
213 msgstr ""
214
215 #. type: IX
216 #: debian-trixie debian-unstable
217 #, no-wrap
218 msgid "identifier"
219 msgstr ""
220
221 #. type: Plain text
222 #: debian-trixie debian-unstable
223 msgid ""
224 "Perl also has its own built-in variables whose names don't follow these "
225 "rules. They have strange names so they don't accidentally collide with one "
226 "of your normal variables. Strings that match parenthesized parts of a "
227 "regular expression are saved under names containing only digits after the "
228 "CW<\\*(C`$\\*(C'> (see perlop and perlre). In addition, several special "
229 "variables that provide windows into the inner working of Perl have names "
230 "containing punctuation characters. These are documented in perlvar."
231 msgstr ""
232
233 #. type: IX
234 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
235 #: opensuse-leap-16-1 opensuse-tumbleweed
236 #, no-wrap
237 msgid "variable, built-in"
238 msgstr ""
239
240 #. type: Plain text
241 #: debian-trixie debian-unstable
242 msgid ""
243 "Scalar values are always named with '$', even when referring to a scalar "
244 "that is part of an array or a hash. The '$' symbol works semantically like "
245 "the English word \"the\" in that it indicates a single value is expected."
246 msgstr ""
247
248 #. type: IX
249 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
250 #: opensuse-leap-16-1 opensuse-tumbleweed
251 #, no-wrap
252 msgid "scalar"
253 msgstr ""
254
255 #. type: Plain text
256 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
257 #: opensuse-leap-16-1 opensuse-tumbleweed
258 #, no-wrap
259 msgid ""
260 "\\& $days # the simple scalar value \"days\"\n"
261 "\\& $days[28] # the 29th element of array @days\n"
262 "\\& $days{\\*(AqFeb\\*(Aq} # the \\*(AqFeb\\*(Aq value from hash %days\n"
263 "\\& $#days # the last index of array @days\n"
264 msgstr ""
265
266 #. type: Plain text
267 #: debian-trixie debian-unstable
268 msgid ""
269 "Entire arrays (and slices of arrays and hashes) are denoted by '@', which "
270 "works much as the word \"these\" or \"those\" does in English, in that it "
271 "indicates multiple values are expected."
272 msgstr ""
273
274 #. type: IX
275 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
276 #: opensuse-leap-16-1 opensuse-tumbleweed
277 #, no-wrap
278 msgid "array"
279 msgstr ""
280
281 #. type: Plain text
282 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
283 #: opensuse-leap-16-1 opensuse-tumbleweed
284 #, no-wrap
285 msgid ""
286 "\\& @days # ($days[0], $days[1],... $days[n])\n"
287 "\\& @days[3,4,5] # same as ($days[3],$days[4],$days[5])\n"
288 "\\& @days{\\*(Aqa\\*(Aq,\\*(Aqc\\*(Aq} # same as ($days{\\*(Aqa\\*(Aq},$days{\\*(Aqc\\*(Aq})\n"
289 msgstr ""
290
291 #. type: Plain text
292 #: debian-trixie debian-unstable
293 msgid "Entire hashes are denoted by '%':"
294 msgstr ""
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 "hash"
301 msgstr ""
302
303 #. type: Plain text
304 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
305 #: opensuse-leap-16-1 opensuse-tumbleweed
306 #, no-wrap
307 msgid "\\& %days # (key1, val1, key2, val2 ...)\n"
308 msgstr ""
309
310 #. type: Plain text
311 #: debian-trixie debian-unstable
312 msgid ""
313 "In addition, subroutines are named with an initial '&', though this is "
314 "optional when unambiguous, just as the word \"do\" is often redundant in "
315 "English. Symbol table entries can be named with an initial '*', but you "
316 "don't really care about that yet (if ever :-)."
317 msgstr ""
318
319 #. type: Plain text
320 #: debian-trixie debian-unstable
321 msgid ""
322 "Every variable type has its own namespace, as do several non-variable "
323 "identifiers. This means that you can, without fear of conflict, use the "
324 "same name for a scalar variable, an array, or a hash--or, for that matter, "
325 "for a filehandle, a directory handle, a subroutine name, a format name, or a "
326 "label. This means that CW<$foo> and CW<@foo> are two different variables. "
327 "It also means that CW<$foo[1]> is a part of CW<@foo>, not a part of "
328 "CW<$foo>. This may seem a bit weird, but that's okay, because it is weird."
329 msgstr ""
330
331 #. type: IX
332 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
333 #: opensuse-leap-16-1 opensuse-tumbleweed
334 #, no-wrap
335 msgid "namespace"
336 msgstr ""
337
338 #. type: Plain text
339 #: debian-trixie debian-unstable
340 msgid ""
341 "Because variable references always start with '$', '@', or '%', the "
342 "\"reserved\" words aren't in fact reserved with respect to variable names. "
343 "They I<are> reserved with respect to labels and filehandles, however, which "
344 "don't have an initial special character. You can't have a filehandle named "
345 "\"log\", for instance. Hint: you could say \\&CW<\\*(C`open(LOG,"
346 "\\*(Aqlogfile\\*(Aq)\\*(C'> rather than CW<\\*(C`open(log,"
347 "\\*(Aqlogfile\\*(Aq)\\*(C'>. Using uppercase filehandles also improves "
348 "readability and protects you from conflict with future reserved words. Case "
349 "I<is> significant--\"FOO\", \"Foo\", and \"foo\" are all different names. "
350 "Names that start with a letter or underscore may also contain digits and "
351 "underscores."
352 msgstr ""
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 "identifier, case sensitivity case"
359 msgstr ""
360
361 #. type: Plain text
362 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
363 #: opensuse-leap-16-1 opensuse-tumbleweed
364 msgid ""
365 "It is possible to replace such an alphanumeric name with an expression that "
366 "returns a reference to the appropriate type. For a description of this, see "
367 "perlref."
368 msgstr ""
369
370 #. type: Plain text
371 #: debian-trixie debian-unstable
372 msgid ""
373 "Names that start with a digit may contain only more digits. Names that do "
374 "not start with a letter, underscore, digit or a caret are limited to one "
375 "character, e.g., CW<$%> or \\&CW<$$>. (Most of these one character names "
376 "have a predefined significance to Perl. For instance, CW<$$> is the current "
377 "process id. And all such names are reserved for Perl's possible use.)"
378 msgstr ""
379
380 #. type: IX
381 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
382 #: opensuse-leap-16-1 opensuse-tumbleweed
383 #, no-wrap
384 msgid "Identifier parsing"
385 msgstr ""
386
387 #. type: IX
388 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
389 #: opensuse-leap-16-1 opensuse-tumbleweed
390 #, no-wrap
391 msgid "identifiers"
392 msgstr ""
393
394 #. type: Plain text
395 #: debian-trixie debian-unstable
396 msgid ""
397 "Up until Perl 5.18, the actual rules of what a valid identifier was were a "
398 "bit fuzzy. However, in general, anything defined here should work on "
399 "previous versions of Perl, while the opposite -- edge cases that work in "
400 "previous versions, but aren't defined here -- probably won't work on newer "
401 "versions. As an important side note, please note that the following only "
402 "applies to bareword identifiers as found in Perl source code, not "
403 "identifiers introduced through symbolic references, which have much fewer "
404 "restrictions. If working under the effect of the CW<\\*(C`use utf8;\\*(C'> "
405 "pragma, the following rules apply:"
406 msgstr ""
407
408 #. type: Plain text
409 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
410 #: opensuse-leap-16-1 opensuse-tumbleweed
411 #, no-wrap
412 msgid ""
413 "\\& / (?[ ( \\ep{Word} & \\ep{XID_Start} ) + [_] ])\n"
414 "\\& (?[ ( \\ep{Word} & \\ep{XID_Continue} ) ]) * /x\n"
415 msgstr ""
416
417 #. type: Plain text
418 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
419 #: opensuse-leap-16-1 opensuse-tumbleweed
420 msgid ""
421 "That is, a \"start\" character followed by any number of \"continue\" "
422 "characters. Perl requires every character in an identifier to also match "
423 "CW<\\*(C`\\ew\\*(C'> (this prevents some problematic cases); and Perl "
424 "additionally accepts identifier names beginning with an underscore."
425 msgstr ""
426
427 #. type: Plain text
428 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
429 #: opensuse-leap-16-1 opensuse-tumbleweed
430 msgid ""
431 "If not under CW<\\*(C`use utf8\\*(C'>, the source is treated as ASCII + 128 "
432 "extra generic characters, and identifiers should match"
433 msgstr ""
434
435 #. type: Plain text
436 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
437 #: opensuse-leap-16-1 opensuse-tumbleweed
438 #, no-wrap
439 msgid "\\& / (?aa) (?!\\ed) \\ew+ /x\n"
440 msgstr ""
441
442 #. type: Plain text
443 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
444 #: opensuse-leap-16-1 opensuse-tumbleweed
445 msgid ""
446 "That is, any word character in the ASCII range, as long as the first "
447 "character is not a digit."
448 msgstr ""
449
450 #. type: Plain text
451 #: debian-trixie debian-unstable
452 msgid ""
453 "There are two package separators in Perl: A double colon (CW<\\*(C`::"
454 "\\*(C'>) and a single quote (CW<\\*(C`\\*(Aq\\*(C'>). Use of "
455 "CW<\\*(C`\\*(Aq\\*(C'> as the package separator is deprecated and will be "
456 "removed in Perl 5.40. Normal identifiers can start or end with a double "
457 "colon, and can contain several parts delimited by double colons. Single "
458 "quotes have similar rules, but with the exception that they are not legal at "
459 "the end of an identifier: That is, CW<\\*(C`$\\*(Aqfoo\\*(C'> and "
460 "CW<\\*(C`$foo\\*(Aqbar\\*(C'> are legal, but "
461 "\\&CW<\\*(C`$foo\\*(Aqbar\\*(Aq\\*(C'> is not."
462 msgstr ""
463
464 #. type: Plain text
465 #: debian-trixie debian-unstable
466 msgid ""
467 "Additionally, if the identifier is preceded by a sigil -- that is, if the "
468 "identifier is part of a variable name -- it may optionally be enclosed in "
469 "braces."
470 msgstr ""
471
472 #. type: Plain text
473 #: debian-trixie debian-unstable
474 msgid ""
475 "While you can mix double colons with singles quotes, the quotes must come "
476 "after the colons: CW<\\*(C`$::::\\*(Aqfoo\\*(C'> and CW<\\*(C`$foo::"
477 "\\*(Aqbar\\*(C'> are legal, but CW<\\*(C`$::\\*(Aq::foo\\*(C'> and "
478 "CW<\\*(C`$foo\\*(Aq::bar\\*(C'> are not."
479 msgstr ""
480
481 #. type: Plain text
482 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
483 #: opensuse-leap-16-1 opensuse-tumbleweed
484 msgid "Put together, a grammar to match a basic identifier becomes"
485 msgstr ""
486
487 #. type: Plain text
488 #: debian-trixie debian-unstable
489 #, no-wrap
490 msgid ""
491 "\\& /\n"
492 "\\& (?(DEFINE)\n"
493 "\\& (?E<lt>variableE<gt>\n"
494 "\\& (?&sigil)\n"
495 "\\& (?:\n"
496 "\\& (?&normal_identifier)\n"
497 "\\& | \\e{ \\es* (?&normal_identifier) \\es* \\e}\n"
498 "\\& )\n"
499 "\\& )\n"
500 "\\& (?E<lt>normal_identifierE<gt>\n"
501 "\\& (?: :: )* \\*(Aq?\n"
502 "\\& (?&basic_identifier)\n"
503 "\\& (?: (?= (?: :: )+ \\*(Aq? | (?: :: )* \\*(Aq ) (?&normal_identifier) )?\n"
504 "\\& (?: :: )*\n"
505 "\\& )\n"
506 "\\& (?E<lt>basic_identifierE<gt>\n"
507 "\\& # is use utf8 on?\n"
508 "\\& (?(?{ (caller(0))[8] & $utf8::hint_bits })\n"
509 "\\& (?&Perl_XIDS) (?&Perl_XIDC)*\n"
510 "\\& | (?aa) (?!\\ed) \\ew+\n"
511 "\\& )\n"
512 "\\& )\n"
513 "\\& (?E<lt>sigilE<gt> [&*\\e$\\e@\\e%])\n"
514 "\\& (?E<lt>Perl_XIDSE<gt> (?[ ( \\ep{Word} & \\ep{XID_Start} ) + [_] ]) )\n"
515 "\\& (?E<lt>Perl_XIDCE<gt> (?[ \\ep{Word} & \\ep{XID_Continue} ]) )\n"
516 "\\& )\n"
517 "\\& /x\n"
518 msgstr ""
519
520 #. type: Plain text
521 #: debian-trixie debian-unstable
522 msgid ""
523 "Meanwhile, special identifiers don't follow the above rules; For the most "
524 "part, all of the identifiers in this category have a special meaning given "
525 "by Perl. Because they have special parsing rules, these generally can't be "
526 "fully-qualified. They come in six forms (but don't use forms 5 and 6):"
527 msgstr ""
528
529 #. type: IP
530 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
531 #: opensuse-leap-16-1 opensuse-tumbleweed
532 #, no-wrap
533 msgid "1."
534 msgstr ""
535
536 #. type: Plain text
537 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
538 #: opensuse-leap-16-1 opensuse-tumbleweed
539 msgid ""
540 "A sigil, followed solely by digits matching CW<\\*(C`\\ep{POSIX_Digit}"
541 "\\*(C'>, like \\&CW<$0>, CW<$1>, or CW<$10000>."
542 msgstr ""
543
544 #. type: IP
545 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
546 #: opensuse-leap-16-1 opensuse-tumbleweed
547 #, no-wrap
548 msgid "2."
549 msgstr ""
550
551 #. type: Plain text
552 #: debian-trixie debian-unstable
553 msgid ""
554 "A sigil followed by a single character matching the "
555 "CW<\\*(C`\\ep{POSIX_Punct}\\*(C'> property, like CW<$!> or CW<\\*(C`%+"
556 "\\*(C'>, except the character CW<\"{\"> doesn't work."
557 msgstr ""
558
559 #. type: IP
560 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
561 #: opensuse-leap-16-1 opensuse-tumbleweed
562 #, no-wrap
563 msgid "3."
564 msgstr ""
565
566 #. type: Plain text
567 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
568 #: opensuse-leap-16-1 opensuse-tumbleweed
569 msgid ""
570 "A sigil, followed by a caret and any one of the characters \\&CW<\\*(C`[][A-"
571 "Z^_?\\e]\\*(C'>, like CW<$^V> or CW<$^]>."
572 msgstr ""
573
574 #. type: IP
575 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
576 #: opensuse-leap-16-1 opensuse-tumbleweed
577 #, no-wrap
578 msgid "4."
579 msgstr ""
580
581 #. type: Plain text
582 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
583 #: opensuse-leap-16-1 opensuse-tumbleweed
584 msgid ""
585 "Similar to the above, a sigil, followed by bareword text in braces, where "
586 "the first character is a caret. The next character is any one of the "
587 "characters CW<\\*(C`[][A-Z^_?\\e]\\*(C'>, followed by ASCII word "
588 "characters. An example is CW<\\*(C`${^GLOBAL_PHASE}\\*(C'>."
589 msgstr ""
590
591 #. type: IP
592 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
593 #: opensuse-leap-16-1 opensuse-tumbleweed
594 #, no-wrap
595 msgid "5."
596 msgstr ""
597
598 #. type: Plain text
599 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
600 #: opensuse-leap-16-1 opensuse-tumbleweed
601 msgid ""
602 "A sigil, followed by any single character in the range CW<\\*(C`[\\exA1-"
603 "\\exAC\\exAE-\\exFF]\\*(C'> when not under CW<\"use\\ utf8\">. (Under "
604 "CW<\"use\\ utf8\">, the normal identifier rules given earlier in this "
605 "section apply.) Use of non-graphic characters (the C1 controls, the NO-"
606 "BREAK SPACE, and the SOFT HYPHEN) has been disallowed since v5.26.0. The "
607 "use of the other characters is unwise, as these are all reserved to have "
608 "special meaning to Perl, and none of them currently do have special meaning, "
609 "though this could change without notice."
610 msgstr ""
611
612 #. type: Plain text
613 #: debian-trixie debian-unstable
614 msgid ""
615 "Note that an implication of this form is that there are identifiers only "
616 "legal under CW<\"use\\ utf8\">, and vice-versa, for example the identifier "
617 "\\&CW<\\*(C`$état\\*(C'> is legal under CW<\"use\\ utf8\">, but is otherwise "
618 "considered to be the single character variable CW<$é> followed by the "
619 "bareword CW<\"tat\">, the combination of which is a syntax error."
620 msgstr ""
621
622 #. type: IP
623 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
624 #: opensuse-leap-16-1 opensuse-tumbleweed
625 #, no-wrap
626 msgid "6."
627 msgstr ""
628
629 #. type: Plain text
630 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
631 #: opensuse-leap-16-1 opensuse-tumbleweed
632 msgid ""
633 "This is a combination of the previous two forms. It is valid only when not "
634 "under CW<\"use\\ utf8\"> (normal identifier rules apply when under "
635 "\\&CW<\"use\\ utf8\">). The form is a sigil, followed by text in braces, "
636 "where the first character is any one of the characters in the range "
637 "\\&CW<\\*(C`[\\ex80-\\exFF]\\*(C'> followed by ASCII word characters up to "
638 "the trailing brace."
639 msgstr ""
640
641 #. type: Plain text
642 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
643 #: opensuse-leap-16-1 opensuse-tumbleweed
644 msgid ""
645 "The same caveats as the previous form apply: The non-graphic characters are "
646 "no longer allowed with \"use\\ utf8\", it is unwise to use this form at all, "
647 "and utf8ness makes a big difference."
648 msgstr ""
649
650 #. type: Plain text
651 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
652 #: opensuse-leap-16-1 opensuse-tumbleweed
653 msgid ""
654 "Prior to Perl v5.24, non-graphical ASCII control characters were also "
655 "allowed in some situations; this had been deprecated since v5.20."
656 msgstr ""
657
658 #. type: IX
659 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
660 #: opensuse-leap-16-1 opensuse-tumbleweed
661 #, no-wrap
662 msgid "Context"
663 msgstr ""
664
665 #. type: IX
666 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
667 #: opensuse-leap-16-1 opensuse-tumbleweed
668 #, no-wrap
669 msgid "context scalar context list context"
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 "The interpretation of operations and values in Perl sometimes depends on the "
677 "requirements of the context around the operation or value. There are two "
678 "major contexts: list and scalar. Certain operations return list values in "
679 "contexts wanting a list, and scalar values otherwise. If this is true of an "
680 "operation it will be mentioned in the documentation for that operation. In "
681 "other words, Perl overloads certain operations based on whether the expected "
682 "return value is singular or plural. Some words in English work this way, "
683 "like \"fish\" and \"sheep\"."
684 msgstr ""
685
686 #. type: Plain text
687 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
688 #: opensuse-leap-16-1 opensuse-tumbleweed
689 msgid ""
690 "In a reciprocal fashion, an operation provides either a scalar or a list "
691 "context to each of its arguments. For example, if you say"
692 msgstr ""
693
694 #. type: Plain text
695 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
696 #: opensuse-leap-16-1 opensuse-tumbleweed
697 #, no-wrap
698 msgid "\\& int( E<lt>STDINE<gt> )\n"
699 msgstr ""
700
701 #. type: Plain text
702 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
703 #: opensuse-leap-16-1 opensuse-tumbleweed
704 msgid ""
705 "the integer operation provides scalar context for the E<lt>E<gt> operator, "
706 "which responds by reading one line from STDIN and passing it back to the "
707 "integer operation, which will then find the integer value of that line and "
708 "return that. If, on the other hand, you say"
709 msgstr ""
710
711 #. type: Plain text
712 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
713 #: opensuse-leap-16-1 opensuse-tumbleweed
714 #, no-wrap
715 msgid "\\& sort( E<lt>STDINE<gt> )\n"
716 msgstr ""
717
718 #. type: Plain text
719 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
720 #: opensuse-leap-16-1 opensuse-tumbleweed
721 msgid ""
722 "then the sort operation provides list context for E<lt>E<gt>, which will "
723 "proceed to read every line available up to the end of file, and pass that "
724 "list of lines back to the sort routine, which will then sort those lines and "
725 "return them as a list to whatever the context of the sort was."
726 msgstr ""
727
728 #. type: Plain text
729 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
730 #: opensuse-leap-16-1 opensuse-tumbleweed
731 msgid ""
732 "Assignment is a little bit special in that it uses its left argument to "
733 "determine the context for the right argument. Assignment to a scalar "
734 "evaluates the right-hand side in scalar context, while assignment to an "
735 "array or hash evaluates the righthand side in list context. Assignment to a "
736 "list (or slice, which is just a list anyway) also evaluates the right-hand "
737 "side in list context."
738 msgstr ""
739
740 #. type: Plain text
741 #: debian-trixie debian-unstable
742 msgid ""
743 "When you use the CW<\\*(C`use warnings\\*(C'> pragma or Perl's B<-w> command-"
744 "line option, you may see warnings about useless uses of constants or "
745 "functions in \"void context\". Void context just means the value has been "
746 "discarded, such as a statement containing only CW<\\*(C`\"fred\";\\*(C'> or "
747 "CW<\\*(C`getpwuid(0);\\*(C'>. It still counts as scalar context for "
748 "functions that care whether or not they're being called in list context."
749 msgstr ""
750
751 #. type: Plain text
752 #: debian-trixie debian-unstable
753 msgid ""
754 "User-defined subroutines may choose to care whether they are being called in "
755 "a void, scalar, or list context. Most subroutines do not need to bother, "
756 "though. That's because both scalars and lists are automatically "
757 "interpolated into lists. See \"wantarray\" in perlfunc for how you would "
758 "dynamically discern your function's calling context."
759 msgstr ""
760
761 #. type: IX
762 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
763 #: opensuse-leap-16-1 opensuse-tumbleweed
764 #, no-wrap
765 msgid "Scalar values"
766 msgstr ""
767
768 #. type: IX
769 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
770 #: opensuse-leap-16-1 opensuse-tumbleweed
771 #, no-wrap
772 msgid "scalar number string reference"
773 msgstr ""
774
775 #. type: Plain text
776 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
777 #: opensuse-leap-16-1 opensuse-tumbleweed
778 msgid ""
779 "All data in Perl is a scalar, an array of scalars, or a hash of scalars. A "
780 "scalar may contain one single value in any of three different flavors: a "
781 "number, a string, or a reference. In general, conversion from one form to "
782 "another is transparent. Although a scalar may not directly hold multiple "
783 "values, it may contain a reference to an array or hash which in turn "
784 "contains multiple values."
785 msgstr ""
786
787 #. type: Plain text
788 #: debian-trixie debian-unstable
789 msgid ""
790 "Scalars aren't necessarily one thing or another. There's no place to "
791 "declare a scalar variable to be of type \"string\", type \"number\", type "
792 "\"reference\", or anything else. Because of the automatic conversion of "
793 "scalars, operations that return scalars don't need to care (and in fact, "
794 "cannot care) whether their caller is looking for a string, a number, or a "
795 "reference. Perl is a contextually polymorphic language whose scalars can be "
796 "strings, numbers, or references (which includes objects). Although strings "
797 "and numbers are considered pretty much the same thing for nearly all "
798 "purposes, references are strongly-typed, uncastable pointers with builtin "
799 "reference-counting and destructor invocation."
800 msgstr ""
801
802 #. type: Plain text
803 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
804 #: opensuse-leap-16-1 opensuse-tumbleweed
805 msgid ""
806 "A scalar value is interpreted as FALSE in the Boolean sense if it is "
807 "undefined, the null string or the number 0 (or its string equivalent, "
808 "\"0\"), and TRUE if it is anything else. The Boolean context is just a "
809 "special kind of scalar context where no conversion to a string or a number "
810 "is ever performed. Negation of a true value by CW<\\*(C`!\\*(C'> or "
811 "CW<\\*(C`not\\*(C'> returns a special false value. When evaluated as a "
812 "string it is treated as CW<\"\">, but as a number, it is treated as 0. Most "
813 "Perl operators that return true or false behave this way."
814 msgstr ""
815
816 #. type: IX
817 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
818 #: opensuse-leap-16-1 opensuse-tumbleweed
819 #, no-wrap
820 msgid "truth falsehood true false ! not negation 0 boolean bool"
821 msgstr ""
822
823 #. type: Plain text
824 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
825 #: opensuse-leap-16-1 opensuse-tumbleweed
826 msgid ""
827 "There are actually two varieties of null strings (sometimes referred to as "
828 "\"empty\" strings), a defined one and an undefined one. The defined version "
829 "is just a string of length zero, such as CW<\"\">. The undefined version is "
830 "the value that indicates that there is no real value for something, such as "
831 "when there was an error, or at end of file, or when you refer to an "
832 "uninitialized variable or element of an array or hash. Although in early "
833 "versions of Perl, an undefined scalar could become defined when first used "
834 "in a place expecting a defined value, this no longer happens except for rare "
835 "cases of autovivification as explained in perlref. You can use the "
836 "B<defined()> operator to determine whether a scalar value is defined (this "
837 "has no meaning on arrays or hashes), and the B<undef()> operator to produce "
838 "an undefined value."
839 msgstr ""
840
841 #. type: IX
842 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
843 #: opensuse-leap-16-1 opensuse-tumbleweed
844 #, no-wrap
845 msgid "defined undefined undef null string, null"
846 msgstr ""
847
848 #. type: Plain text
849 #: debian-trixie debian-unstable
850 msgid ""
851 "To find out whether a given string is a valid non-zero number, it's "
852 "sometimes enough to test it against both numeric 0 and also lexical \"0\" "
853 "(although this will cause noises if warnings are on). That's because "
854 "strings that aren't numbers count as 0, just as they do in B<awk>:"
855 msgstr ""
856
857 #. type: Plain text
858 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
859 #: opensuse-leap-16-1 opensuse-tumbleweed
860 #, no-wrap
861 msgid ""
862 "\\& if ($str == 0 && $str ne \"0\") {\n"
863 "\\& warn \"That doesn\\*(Aqt look like a number\";\n"
864 "\\& }\n"
865 msgstr ""
866
867 #. type: Plain text
868 #: debian-trixie debian-unstable
869 msgid ""
870 "That method may be best because otherwise you won't treat IEEE notations "
871 "like CW<\\*(C`NaN\\*(C'> or CW<\\*(C`Infinity\\*(C'> properly. At other "
872 "times, you might prefer to determine whether string data can be used "
873 "numerically by calling the B<POSIX::strtod()> function or by inspecting your "
874 "string with a regular expression (as documented in perlre)."
875 msgstr ""
876
877 #. type: Plain text
878 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
879 #: opensuse-leap-16-1 opensuse-tumbleweed
880 #, no-wrap
881 msgid ""
882 "\\& warn \"has nondigits\" if /\\eD/;\n"
883 "\\& warn \"not a natural number\" unless /^\\ed+$/; # rejects -3\n"
884 "\\& warn \"not an integer\" unless /^-?\\ed+$/; # rejects +3\n"
885 "\\& warn \"not an integer\" unless /^[+-]?\\ed+$/;\n"
886 "\\& warn \"not a decimal number\" unless /^-?\\ed+\\e.?\\ed*$/; # rejects .2\n"
887 "\\& warn \"not a decimal number\" unless /^-?(?:\\ed+(?:\\e.\\ed*)?|\\e.\\ed+)$/;\n"
888 "\\& warn \"not a C float\"\n"
889 "\\& unless /^([+-]?)(?=\\ed|\\e.\\ed)\\ed*(\\e.\\ed*)?([Ee]([+-]?\\ed+))?$/;\n"
890 msgstr ""
891
892 #. type: Plain text
893 #: debian-trixie debian-unstable
894 msgid ""
895 "The length of an array is a scalar value. You may find the length of array "
896 "CW<@days> by evaluating CW<$#days>, as in B<csh>. However, this isn't the "
897 "length of the array; it's the subscript of the last element, which is a "
898 "different value since there is ordinarily a 0th element. Assigning to "
899 "CW<$#days> actually changes the length of the array. Shortening an array "
900 "this way destroys intervening values. Lengthening an array that was "
901 "previously shortened does not recover values that were in those elements."
902 msgstr ""
903
904 #. type: IX
905 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
906 #: opensuse-leap-16-1 opensuse-tumbleweed
907 #, no-wrap
908 msgid "$# array, length"
909 msgstr ""
910
911 #. type: Plain text
912 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
913 #: opensuse-leap-16-1 opensuse-tumbleweed
914 msgid ""
915 "You can also gain some minuscule measure of efficiency by pre-extending an "
916 "array that is going to get big. You can also extend an array by assigning "
917 "to an element that is off the end of the array. You can truncate an array "
918 "down to nothing by assigning the null list () to it. The following are "
919 "equivalent:"
920 msgstr ""
921
922 #. type: Plain text
923 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
924 #: opensuse-leap-16-1 opensuse-tumbleweed
925 #, no-wrap
926 msgid ""
927 "\\& @whatever = ();\n"
928 "\\& $#whatever = -1;\n"
929 msgstr ""
930
931 #. type: Plain text
932 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
933 #: opensuse-leap-16-1 opensuse-tumbleweed
934 msgid ""
935 "If you evaluate an array in scalar context, it returns the length of the "
936 "array. (Note that this is not true of lists, which return the last value, "
937 "like the C comma operator, nor of built-in functions, which return whatever "
938 "they feel like returning.) The following is always true:"
939 msgstr ""
940
941 #. type: IX
942 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
943 #: opensuse-leap-16-1 opensuse-tumbleweed
944 #, no-wrap
945 msgid "array, length"
946 msgstr ""
947
948 #. type: Plain text
949 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
950 #: opensuse-leap-16-1 opensuse-tumbleweed
951 #, no-wrap
952 msgid "\\& scalar(@whatever) == $#whatever + 1;\n"
953 msgstr ""
954
955 #. type: Plain text
956 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
957 #: opensuse-leap-16-1 opensuse-tumbleweed
958 msgid ""
959 "Some programmers choose to use an explicit conversion so as to leave nothing "
960 "to doubt:"
961 msgstr ""
962
963 #. type: Plain text
964 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
965 #: opensuse-leap-16-1 opensuse-tumbleweed
966 #, no-wrap
967 msgid "\\& $element_count = scalar(@whatever);\n"
968 msgstr ""
969
970 #. type: Plain text
971 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
972 #: opensuse-leap-16-1 opensuse-tumbleweed
973 msgid ""
974 "If you evaluate a hash in scalar context, it returns a false value if the "
975 "hash is empty. If there are any key/value pairs, it returns a true value. "
976 "A more precise definition is version dependent."
977 msgstr ""
978
979 #. type: Plain text
980 #: debian-trixie debian-unstable
981 msgid ""
982 "Prior to Perl 5.25 the value returned was a string consisting of the number "
983 "of used buckets and the number of allocated buckets, separated by a slash. "
984 "This is pretty much useful only to find out whether Perl's internal hashing "
985 "algorithm is performing poorly on your data set. For example, you stick "
986 "10,000 things in a hash, but evaluating \\&CW<%HASH> in scalar context "
987 "reveals CW<\"1/16\">, which means only one out of sixteen buckets has been "
988 "touched, and presumably contains all 10,000 of your items. This isn't "
989 "supposed to happen."
990 msgstr ""
991
992 #. type: Plain text
993 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
994 #: opensuse-leap-16-1 opensuse-tumbleweed
995 msgid ""
996 "As of Perl 5.25 the return was changed to be the count of keys in the hash. "
997 "If you need access to the old behavior you can use "
998 "\\&CW<Hash::Util::bucket_ratio()> instead."
999 msgstr ""
1000
1001 #. type: Plain text
1002 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1003 #: opensuse-leap-16-1 opensuse-tumbleweed
1004 msgid ""
1005 "If a tied hash is evaluated in scalar context, the CW<\\*(C`SCALAR\\*(C'> "
1006 "method is called (with a fallback to CW<\\*(C`FIRSTKEY\\*(C'>)."
1007 msgstr ""
1008
1009 #. type: IX
1010 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1011 #: opensuse-leap-16-1 opensuse-tumbleweed
1012 #, no-wrap
1013 msgid "hash, scalar context hash, bucket bucket"
1014 msgstr ""
1015
1016 #. type: Plain text
1017 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1018 #: opensuse-leap-16-1 opensuse-tumbleweed
1019 msgid ""
1020 "You can preallocate space for a hash by assigning to the B<keys()> "
1021 "function. This rounds up the allocated buckets to the next power of two:"
1022 msgstr ""
1023
1024 #. type: Plain text
1025 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1026 #: opensuse-leap-16-1 opensuse-tumbleweed
1027 #, no-wrap
1028 msgid "\\& keys(%users) = 1000; # allocate 1024 buckets\n"
1029 msgstr ""
1030
1031 #. type: IX
1032 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1033 #: opensuse-leap-16-1 opensuse-tumbleweed
1034 #, no-wrap
1035 msgid "Scalar value constructors"
1036 msgstr ""
1037
1038 #. type: IX
1039 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1040 #: opensuse-leap-16-1 opensuse-tumbleweed
1041 #, no-wrap
1042 msgid "scalar, literal scalar, constant"
1043 msgstr ""
1044
1045 #. type: Plain text
1046 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1047 #: opensuse-leap-16-1 opensuse-tumbleweed
1048 msgid ""
1049 "Numeric literals are specified in any of the following floating point or "
1050 "integer formats:"
1051 msgstr ""
1052
1053 #. type: Plain text
1054 #: debian-trixie debian-unstable
1055 #, no-wrap
1056 msgid ""
1057 "\\& 12345\n"
1058 "\\& 12345.67\n"
1059 "\\& .23E-10 # a very small number\n"
1060 "\\& 3.14_15_92 # a very important number\n"
1061 "\\& 4_294_967_296 # underscore for legibility\n"
1062 "\\& 0xff # hex\n"
1063 "\\& 0xdead_beef # more hex\n"
1064 "\\& 0377 # octal (only numbers, begins with 0)\n"
1065 "\\& 0o12_345 # alternative octal (introduced in Perl 5.33.5)\n"
1066 "\\& 0b011011 # binary\n"
1067 "\\& 0x1.999ap-4 # hexadecimal floating point (the \\*(Aqp\\*(Aq is required)\n"
1068 msgstr ""
1069
1070 #. type: Plain text
1071 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1072 #: opensuse-leap-16-1 opensuse-tumbleweed
1073 msgid ""
1074 "You are allowed to use underscores (underbars) in numeric literals between "
1075 "digits for legibility (but not multiple underscores in a row: "
1076 "\\&CW<\\*(C`23_\\|_500\\*(C'> is not legal; CW<\\*(C`23_500\\*(C'> is). You "
1077 "could, for example, group binary digits by threes (as for a Unix-style mode "
1078 "argument such as 0b110_100_100) or by fours (to represent nibbles, as in "
1079 "0b1010_0110) or in other groups."
1080 msgstr ""
1081
1082 #. type: IX
1083 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1084 #: opensuse-leap-16-1 opensuse-tumbleweed
1085 #, no-wrap
1086 msgid "number, literal"
1087 msgstr ""
1088
1089 #. type: Plain text
1090 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1091 #: opensuse-leap-16-1 opensuse-tumbleweed
1092 msgid ""
1093 "String literals are usually delimited by either single or double quotes. "
1094 "They work much like quotes in the standard Unix shells: double-quoted string "
1095 "literals are subject to backslash and variable substitution; single-quoted "
1096 "strings are not (except for CW<\\*(C`\\e\\*(Aq\\*(C'> and "
1097 "\\&CW<\\*(C`\\e\\e\\*(C'>). The usual C-style backslash rules apply for "
1098 "making characters such as newline, tab, etc., as well as some more exotic "
1099 "forms. See \"Quote and Quote-like Operators\" in perlop for a list."
1100 msgstr ""
1101
1102 #. type: IX
1103 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1104 #: opensuse-leap-16-1 opensuse-tumbleweed
1105 #, no-wrap
1106 msgid "string, literal"
1107 msgstr ""
1108
1109 #. type: Plain text
1110 #: debian-trixie debian-unstable
1111 msgid ""
1112 "Hexadecimal, octal, or binary, representations in string literals (e.g. "
1113 "'0xff') are not automatically converted to their integer representation. "
1114 "The B<hex()> and B<oct()> functions make these conversions for you. See "
1115 "\"hex\" in perlfunc and \"oct\" in perlfunc for more details."
1116 msgstr ""
1117
1118 #. type: Plain text
1119 #: debian-trixie debian-unstable
1120 msgid ""
1121 "Hexadecimal floating point can start just like a hexadecimal literal, and it "
1122 "can be followed by an optional fractional hexadecimal part, but it must be "
1123 "followed by CW<\\*(C`p\\*(C'>, an optional sign, and a power of two. The "
1124 "format is useful for accurately presenting floating point values, avoiding "
1125 "conversions to or from decimal floating point, and therefore avoiding "
1126 "possible loss in precision. Notice that while most current platforms use "
1127 "the 64-bit IEEE 754 floating point, not all do. Another potential source of "
1128 "(low-order) differences are the floating point rounding modes, which can "
1129 "differ between CPUs, operating systems, and compilers, and which Perl "
1130 "doesn't control."
1131 msgstr ""
1132
1133 #. type: Plain text
1134 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1135 #: opensuse-leap-16-1 opensuse-tumbleweed
1136 msgid ""
1137 "You can also embed newlines directly in your strings, i.e., they can end on "
1138 "a different line than they begin. This is nice, but if you forget your "
1139 "trailing quote, the error will not be reported until Perl finds another line "
1140 "containing the quote character, which may be much further on in the script. "
1141 "Variable substitution inside strings is limited to scalar variables, arrays, "
1142 "and array or hash slices. (In other words, names beginning with $ or @, "
1143 "followed by an optional bracketed expression as a subscript.) The following "
1144 "code segment prints out \"The price is CW<$100>.\""
1145 msgstr ""
1146
1147 #. type: IX
1148 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1149 #: opensuse-leap-16-1 opensuse-tumbleweed
1150 #, no-wrap
1151 msgid "interpolation"
1152 msgstr ""
1153
1154 #. type: Plain text
1155 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1156 #: opensuse-leap-16-1 opensuse-tumbleweed
1157 #, no-wrap
1158 msgid ""
1159 "\\& $Price = \\*(Aq$100\\*(Aq; # not interpolated\n"
1160 "\\& print \"The price is $Price.\\en\"; # interpolated\n"
1161 msgstr ""
1162
1163 #. type: Plain text
1164 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1165 #: opensuse-leap-16-1 opensuse-tumbleweed
1166 msgid ""
1167 "There is no double interpolation in Perl, so the CW<$100> is left as is."
1168 msgstr ""
1169
1170 #. type: Plain text
1171 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1172 #: opensuse-leap-16-1 opensuse-tumbleweed
1173 msgid ""
1174 "By default floating point numbers substituted inside strings use the dot (\"."
1175 "\") as the decimal separator. If CW<\\*(C`use locale\\*(C'> is in effect, "
1176 "and B<POSIX::setlocale()> has been called, the character used for the "
1177 "decimal separator is affected by the LC_NUMERIC locale. See perllocale and "
1178 "POSIX."
1179 msgstr ""
1180
1181 #. type: Plain text
1182 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1183 #: opensuse-leap-16-1 opensuse-tumbleweed
1184 msgid "I<Demarcated variable names using braces>"
1185 msgstr ""
1186
1187 #. type: IX
1188 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1189 #: opensuse-leap-16-1 opensuse-tumbleweed
1190 #, no-wrap
1191 msgid "Demarcated variable names using braces"
1192 msgstr ""
1193
1194 #. type: Plain text
1195 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1196 #: opensuse-leap-16-1 opensuse-tumbleweed
1197 msgid ""
1198 "As in some shells, you can enclose the variable name in braces as a "
1199 "demarcator to disambiguate it from following alphanumerics and underscores "
1200 "or other text. You must also do this when interpolating a variable into a "
1201 "string to separate the variable name from a following double-colon or an "
1202 "apostrophe since these would be otherwise treated as a package separator:"
1203 msgstr ""
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 ""
1210 "\\& $who = \"Larry\";\n"
1211 "\\& print PASSWD \"${who}::0:0:Superuser:/:/bin/perl\\en\";\n"
1212 "\\& print \"We use ${who}speak when ${who}\\*(Aqs here.\\en\";\n"
1213 msgstr ""
1214
1215 #. type: Plain text
1216 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1217 #: opensuse-leap-16-1 opensuse-tumbleweed
1218 msgid ""
1219 "Without the braces, Perl would have looked for a CW<$whospeak>, a "
1220 "\\&CW<$who::0>, and a CW<\\*(C`$who\\*(Aqs\\*(C'> variable. The last two "
1221 "would be the \\&CW<$0> and the CW<$s> variables in the (presumably) non-"
1222 "existent package \\&CW<\\*(C`who\\*(C'>."
1223 msgstr ""
1224
1225 #. type: Plain text
1226 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1227 #: opensuse-leap-16-1 opensuse-tumbleweed
1228 msgid ""
1229 "In fact, a simple identifier within such curly braces is forced to be a "
1230 "string, and likewise within a hash subscript. Neither need quoting. Our "
1231 "earlier example, CW<$days{\\*(AqFeb\\*(Aq}> can be written as CW<$days{Feb}> "
1232 "and the quotes will be assumed automatically. But anything more complicated "
1233 "in the subscript will be interpreted as an expression. This means for "
1234 "example that CW<\\*(C`$version{2.0}++\\*(C'> is equivalent to "
1235 "CW<\\*(C`$version{2}++\\*(C'>, not to CW<\\*(C`$version{\\*(Aq2.0\\*(Aq}++"
1236 "\\*(C'>."
1237 msgstr ""
1238
1239 #. type: Plain text
1240 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1241 #: opensuse-leap-16-1 opensuse-tumbleweed
1242 msgid ""
1243 "There is a similar problem with interpolation with text that looks like "
1244 "array or hash access notation. Placing a simple variable like CW<$who> "
1245 "immediately in front of text like CW<\"[1]\"> or CW<\"{foo}\"> would cause "
1246 "the variable to be interpolated as accessing an element of CW<@who> or a "
1247 "value stored in CW<%who>:"
1248 msgstr ""
1249
1250 #. type: Plain text
1251 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1252 #: opensuse-leap-16-1 opensuse-tumbleweed
1253 #, no-wrap
1254 msgid ""
1255 "\\& $who = \"Larry Wall\";\n"
1256 "\\& print \"$who[1] is the father of Perl.\\en\";\n"
1257 msgstr ""
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 "would attempt to access index 1 of an array named CW<@who>. Again, using "
1264 "braces will prevent this from happening:"
1265 msgstr ""
1266
1267 #. type: Plain text
1268 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1269 #: opensuse-leap-16-1 opensuse-tumbleweed
1270 #, no-wrap
1271 msgid ""
1272 "\\& $who = \"Larry Wall\";\n"
1273 "\\& print \"${who}[1] is the father of Perl.\\en\";\n"
1274 msgstr ""
1275
1276 #. type: Plain text
1277 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1278 #: opensuse-leap-16-1 opensuse-tumbleweed
1279 msgid "will be treated the same as"
1280 msgstr ""
1281
1282 #. type: Plain text
1283 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1284 #: opensuse-leap-16-1 opensuse-tumbleweed
1285 #, no-wrap
1286 msgid ""
1287 "\\& $who = \"Larry Wall\";\n"
1288 "\\& print $who . \"[1] is the father of Perl.\\en\";\n"
1289 msgstr ""
1290
1291 #. type: Plain text
1292 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1293 #: opensuse-leap-16-1 opensuse-tumbleweed
1294 msgid ""
1295 "This notation also applies to more complex variable descriptions, such as "
1296 "array or hash access with subscripts. For instance"
1297 msgstr ""
1298
1299 #. type: Plain text
1300 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1301 #: opensuse-leap-16-1 opensuse-tumbleweed
1302 #, no-wrap
1303 msgid ""
1304 "\\& @name = qw(Larry Curly Moe);\n"
1305 "\\& print \"Also ${name[0]}[1] was a member\\en\";\n"
1306 msgstr ""
1307
1308 #. type: Plain text
1309 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1310 #: opensuse-leap-16-1 opensuse-tumbleweed
1311 msgid ""
1312 "Without the braces the above example would be parsed as a two level array "
1313 "subscript in the CW<@name> array, and under CW<\\*(C`use strict\\*(C'> would "
1314 "likely produce a fatal exception, as it would be parsed like this:"
1315 msgstr ""
1316
1317 #. type: Plain text
1318 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1319 #: opensuse-leap-16-1 opensuse-tumbleweed
1320 #, no-wrap
1321 msgid "\\& print \"Also \" . $name[0][1] . \" was a member\\en\";\n"
1322 msgstr ""
1323
1324 #. type: Plain text
1325 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1326 #: opensuse-leap-16-1 opensuse-tumbleweed
1327 msgid "and not as the intended:"
1328 msgstr ""
1329
1330 #. type: Plain text
1331 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1332 #: opensuse-leap-16-1 opensuse-tumbleweed
1333 #, no-wrap
1334 msgid "\\& print \"Also \" . $name[0] . \"[1] was a member\\en\";\n"
1335 msgstr ""
1336
1337 #. type: Plain text
1338 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1339 #: opensuse-leap-16-1 opensuse-tumbleweed
1340 msgid ""
1341 "A similar result may be derived by using a backslash on the first character "
1342 "of the subscript or package notation that is not part of the variable you "
1343 "want to access. Thus the above example could also be written:"
1344 msgstr ""
1345
1346 #. type: Plain text
1347 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1348 #: opensuse-leap-16-1 opensuse-tumbleweed
1349 #, no-wrap
1350 msgid ""
1351 "\\& @name = qw(Larry Curly Moe);\n"
1352 "\\& print \"Also $name[0]\\e[1] was a member\\en\";\n"
1353 msgstr ""
1354
1355 #. type: Plain text
1356 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1357 #: opensuse-leap-16-1 opensuse-tumbleweed
1358 msgid ""
1359 "however for some special variables (multi character caret variables) the "
1360 "demarcated form using curly braces is the B<only> way you can reference the "
1361 "variable at all, and the only way you can access a subscript of the variable "
1362 "via interpolation."
1363 msgstr ""
1364
1365 #. type: Plain text
1366 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1367 #: opensuse-leap-16-1 opensuse-tumbleweed
1368 msgid ""
1369 "Consider the magic array CW<\\*(C`@{^CAPTURE}\\*(C'> which is populated by "
1370 "the regex engine with the contents of all of the capture buffers in a "
1371 "pattern (see perlvar and perlre). The B<only> way you can access one of "
1372 "these members inside of a string is via the braced (demarcated) form:"
1373 msgstr ""
1374
1375 #. type: Plain text
1376 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1377 #: opensuse-leap-16-1 opensuse-tumbleweed
1378 #, no-wrap
1379 msgid ""
1380 "\\& \"abc\"=~/(.)(.)(.)/\n"
1381 "\\& and print \"Second buffer is ${^CAPTURE[1]}\";\n"
1382 msgstr ""
1383
1384 #. type: Plain text
1385 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1386 #: opensuse-leap-16-1 opensuse-tumbleweed
1387 msgid "is equivalent to"
1388 msgstr ""
1389
1390 #. type: Plain text
1391 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1392 #: opensuse-leap-16-1 opensuse-tumbleweed
1393 #, no-wrap
1394 msgid ""
1395 "\\& \"abc\"=~/(.)(.)(.)/\n"
1396 "\\& and print \"Second buffer is \" . ${^CAPTURE}[1];\n"
1397 msgstr ""
1398
1399 #. type: Plain text
1400 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1401 #: opensuse-leap-16-1 opensuse-tumbleweed
1402 msgid ""
1403 "Saying CW<\\*(C`@^CAPTURE\\*(C'> is a syntax error, so it B<must> be "
1404 "referenced as \\&CW<\\*(C`@{^CAPTURE}\\*(C'>, and to access one of its "
1405 "elements in normal code you would write CW<\\*(C` ${^CAPTURE}[1] \\*(C'>. "
1406 "However when interpolating in a string \\&CW<\"${^CAPTURE}[1]\"> would be "
1407 "equivalent to CW<\\*(C`${^CAPTURE} . \"[1]\"\\*(C'>, which does not even "
1408 "refer to the same variable! Thus the subscripts must \\&B<also> be placed "
1409 "B<inside> of the braces: CW<\"${^CAPTURE[1]}\">."
1410 msgstr ""
1411
1412 #. type: Plain text
1413 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1414 #: opensuse-leap-16-1 opensuse-tumbleweed
1415 msgid ""
1416 "The demarcated form using curly braces can be used with all the different "
1417 "types of variable access, including array and hash slices. For instance code "
1418 "like the following:"
1419 msgstr ""
1420
1421 #. type: Plain text
1422 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1423 #: opensuse-leap-16-1 opensuse-tumbleweed
1424 #, no-wrap
1425 msgid ""
1426 "\\& @name = qw(Larry Curly Moe);\n"
1427 "\\& local $\" = \" and \";\n"
1428 "\\& print \"My favorites were @{name[1,2]}.\\en\";\n"
1429 msgstr ""
1430
1431 #. type: Plain text
1432 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1433 #: opensuse-leap-16-1 opensuse-tumbleweed
1434 msgid "would output"
1435 msgstr ""
1436
1437 #. type: Plain text
1438 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1439 #: opensuse-leap-16-1 opensuse-tumbleweed
1440 #, no-wrap
1441 msgid "\\& My favorites were Curly and Moe.\n"
1442 msgstr ""
1443
1444 #. type: Plain text
1445 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1446 #: opensuse-leap-16-1 opensuse-tumbleweed
1447 msgid "I<Special floating point: infinity (Inf) and not-a-number (NaN)>"
1448 msgstr ""
1449
1450 #. type: IX
1451 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1452 #: opensuse-leap-16-1 opensuse-tumbleweed
1453 #, no-wrap
1454 msgid "Special floating point: infinity (Inf) and not-a-number (NaN)"
1455 msgstr ""
1456
1457 #. type: Plain text
1458 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1459 #: opensuse-leap-16-1 opensuse-tumbleweed
1460 msgid ""
1461 "Floating point values include the special values CW<\\*(C`Inf\\*(C'> and "
1462 "CW<\\*(C`NaN\\*(C'>, for infinity and not-a-number. The infinity can be "
1463 "also negative."
1464 msgstr ""
1465
1466 #. type: Plain text
1467 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1468 #: opensuse-leap-16-1 opensuse-tumbleweed
1469 msgid ""
1470 "The infinity is the result of certain math operations that overflow the "
1471 "floating point range, like 9**9**9. The not-a-number is the result when the "
1472 "result is undefined or unrepresentable. Though note that you cannot get "
1473 "CW<\\*(C`NaN\\*(C'> from some common \"undefined\" or \"out-of-range\" "
1474 "operations like dividing by zero, or square root of a negative number, since "
1475 "Perl generates fatal errors for those."
1476 msgstr ""
1477
1478 #. type: Plain text
1479 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1480 #: opensuse-leap-16-1 opensuse-tumbleweed
1481 msgid ""
1482 "The infinity and not-a-number have their own special arithmetic rules. The "
1483 "general rule is that they are \"contagious\": CW<\\*(C`Inf\\*(C'> plus one "
1484 "is \\&CW<\\*(C`Inf\\*(C'>, and CW<\\*(C`NaN\\*(C'> plus one is "
1485 "CW<\\*(C`NaN\\*(C'>. Where things get interesting is when you combine "
1486 "infinities and not-a-numbers: CW<\\*(C`Inf\\*(C'> minus CW<\\*(C`Inf\\*(C'> "
1487 "and CW<\\*(C`Inf\\*(C'> divided by CW<\\*(C`Inf\\*(C'> are "
1488 "CW<\\*(C`NaN\\*(C'> (while CW<\\*(C`Inf\\*(C'> plus CW<\\*(C`Inf\\*(C'> is "
1489 "\\&CW<\\*(C`Inf\\*(C'> and CW<\\*(C`Inf\\*(C'> times CW<\\*(C`Inf\\*(C'> is "
1490 "CW<\\*(C`Inf\\*(C'>). CW<\\*(C`NaN\\*(C'> is also curious in that it does "
1491 "not equal any number, I<including> itself: \\&CW<\\*(C`NaN\\*(C'> != "
1492 "CW<\\*(C`NaN\\*(C'>."
1493 msgstr ""
1494
1495 #. type: Plain text
1496 #: debian-trixie debian-unstable
1497 msgid ""
1498 "Perl doesn't understand CW<\\*(C`Inf\\*(C'> and CW<\\*(C`NaN\\*(C'> as "
1499 "numeric literals, but you can have them as strings, and Perl will convert "
1500 "them as needed: \"Inf\" + 1. (You can, however, import them from the POSIX "
1501 "extension; \\&CW<\\*(C`use POSIX qw(Inf NaN);\\*(C'> and then use them as "
1502 "literals.)"
1503 msgstr ""
1504
1505 #. type: Plain text
1506 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1507 #: opensuse-leap-16-1 opensuse-tumbleweed
1508 msgid ""
1509 "Note that on input (string to number) Perl accepts CW<\\*(C`Inf\\*(C'> and "
1510 "CW<\\*(C`NaN\\*(C'> in many forms. Case is ignored, and the Win32-specific "
1511 "forms like \\&CW<\\*(C`1.#INF\\*(C'> are understood, but on output the "
1512 "values are normalized to \\&CW<\\*(C`Inf\\*(C'> and CW<\\*(C`NaN\\*(C'>."
1513 msgstr ""
1514
1515 #. type: Plain text
1516 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1517 #: opensuse-leap-16-1 opensuse-tumbleweed
1518 msgid "I<Version Strings>"
1519 msgstr ""
1520
1521 #. type: IX
1522 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1523 #: opensuse-leap-16-1 opensuse-tumbleweed
1524 #, no-wrap
1525 msgid "version string vstring v-string"
1526 msgstr ""
1527
1528 #. type: IX
1529 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1530 #: opensuse-leap-16-1 opensuse-tumbleweed
1531 #, no-wrap
1532 msgid "Version Strings"
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 ""
1539 "A literal of the form CW<\\*(C`v1.20.300.4000\\*(C'> is parsed as a string "
1540 "composed of characters with the specified ordinals. This form, known as v-"
1541 "strings, provides an alternative, more readable way to construct strings, "
1542 "rather than use the somewhat less readable interpolation form "
1543 "\\&CW<\"\\ex{1}\\ex{14}\\ex{12c}\\ex{fa0}\">. This is useful for "
1544 "representing Unicode strings, and for comparing version \"numbers\" using "
1545 "the string comparison operators, CW<\\*(C`cmp\\*(C'>, CW<\\*(C`gt\\*(C'>, "
1546 "CW<\\*(C`lt\\*(C'> etc. If there are two or more dots in the literal, the "
1547 "leading CW<\\*(C`v\\*(C'> may be omitted."
1548 msgstr ""
1549
1550 #. type: Plain text
1551 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1552 #: opensuse-leap-16-1 opensuse-tumbleweed
1553 #, no-wrap
1554 msgid ""
1555 "\\& print v9786; # prints SMILEY, \"\\ex{263a}\"\n"
1556 "\\& print v102.111.111; # prints \"foo\"\n"
1557 "\\& print 102.111.111; # same\n"
1558 msgstr ""
1559
1560 #. type: Plain text
1561 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1562 #: opensuse-leap-16-1 opensuse-tumbleweed
1563 msgid ""
1564 "Such literals are accepted by both CW<\\*(C`require\\*(C'> and "
1565 "CW<\\*(C`use\\*(C'> for doing a version check. Note that using the v-"
1566 "strings for IPv4 addresses is not portable unless you also use the "
1567 "\\&B<inet_aton()>/B<inet_ntoa()> routines of the Socket package."
1568 msgstr ""
1569
1570 #. type: Plain text
1571 #: debian-trixie debian-unstable
1572 msgid ""
1573 "Note that since Perl 5.8.1 the single-number v-strings (like "
1574 "CW<\\*(C`v65\\*(C'>) are not v-strings before the CW<\\*(C`=E<gt>\\*(C'> "
1575 "operator (which is usually used to separate a hash key from a hash value); "
1576 "instead they are interpreted as literal strings ('v65'). They were v-"
1577 "strings from Perl 5.6.0 to Perl 5.8.0, but that caused more confusion and "
1578 "breakage than good. Multi-number v-strings like CW<\\*(C`v65.66\\*(C'> and "
1579 "CW<65.66.67> continue to be v-strings always."
1580 msgstr ""
1581
1582 #. type: Plain text
1583 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1584 #: opensuse-leap-16-1 opensuse-tumbleweed
1585 msgid "I<Special Literals>"
1586 msgstr ""
1587
1588 #. type: IX
1589 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1590 #: opensuse-leap-16-1 opensuse-tumbleweed
1591 #, no-wrap
1592 msgid "special literal __END__ __DATA__ END DATA end data ^D ^Z"
1593 msgstr ""
1594
1595 #. type: IX
1596 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1597 #: opensuse-leap-16-1 opensuse-tumbleweed
1598 #, no-wrap
1599 msgid "Special Literals"
1600 msgstr ""
1601
1602 #. type: Plain text
1603 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1604 #: opensuse-leap-16-1 opensuse-tumbleweed
1605 msgid ""
1606 "The special literals _\\|_FILE_\\|_, _\\|_LINE_\\|_, and _\\|_PACKAGE_\\|_ "
1607 "represent the current filename, line number, and package name at that point "
1608 "in your program. _\\|_SUB_\\|_ gives a reference to the current "
1609 "subroutine. They may be used only as separate tokens; they will not be "
1610 "interpolated into strings. If there is no current package (due to an empty "
1611 "CW<\\*(C`package;\\*(C'> directive), _\\|_PACKAGE_\\|_ is the undefined "
1612 "value. (But the empty CW<\\*(C`package;\\*(C'> is no longer supported, as "
1613 "of version 5.10.) Outside of a subroutine, _\\|_SUB_\\|_ is the undefined "
1614 "value. _\\|_SUB_\\|_ is only available in 5.16 or higher, and only with a "
1615 "CW<\\*(C`use v5.16\\*(C'> or \\&CW<\\*(C`use feature \"current_sub\"\\*(C'> "
1616 "declaration."
1617 msgstr ""
1618
1619 #. type: IX
1620 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1621 #: opensuse-leap-16-1 opensuse-tumbleweed
1622 #, no-wrap
1623 msgid "__FILE__ __LINE__ __PACKAGE__ __SUB__ line file package"
1624 msgstr ""
1625
1626 #. type: Plain text
1627 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1628 #: opensuse-leap-16-1 opensuse-tumbleweed
1629 msgid ""
1630 "The two control characters ^D and ^Z, and the tokens _\\|_END_\\|_ and _\\|"
1631 "_DATA_\\|_ may be used to indicate the logical end of the script before the "
1632 "actual end of file. Any following text is ignored by the interpreter unless "
1633 "read by the program as described below."
1634 msgstr ""
1635
1636 #. type: Plain text
1637 #: debian-trixie debian-unstable
1638 msgid ""
1639 "Text after _\\|_DATA_\\|_ may be read via the filehandle "
1640 "CW<\\*(C`PACKNAME::DATA\\*(C'>, where CW<\\*(C`PACKNAME\\*(C'> is the "
1641 "package that was current when the _\\|_DATA_\\|_ token was encountered. The "
1642 "filehandle is left open pointing to the line after _\\|_DATA_\\|_. The "
1643 "program should CW<\\*(C`close DATA\\*(C'> when it is done reading from it. "
1644 "(Leaving it open leaks filehandles if the module is reloaded for any reason, "
1645 "so it's a safer practice to close it.) For compatibility with older scripts "
1646 "written before _\\|_DATA_\\|_ was introduced, _\\|_END_\\|_ behaves like _\\|"
1647 "_DATA_\\|_ in the top level script (but not in files loaded with "
1648 "CW<\\*(C`require\\*(C'> or CW<\\*(C`do\\*(C'>) and leaves the remaining "
1649 "contents of the file accessible via CW<\\*(C`main::DATA\\*(C'>."
1650 msgstr ""
1651
1652 #. type: Plain text
1653 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1654 #: opensuse-leap-16-1 opensuse-tumbleweed
1655 #, no-wrap
1656 msgid ""
1657 "\\& while (my $line = E<lt>DATAE<gt>) { print $line; }\n"
1658 "\\& close DATA;\n"
1659 "\\& _\\|_DATA_\\|_\n"
1660 "\\& Hello world.\n"
1661 msgstr ""
1662
1663 #. type: Plain text
1664 #: debian-trixie debian-unstable
1665 msgid ""
1666 "The CW<\\*(C`DATA\\*(C'> file handle by default has whatever PerlIO layers "
1667 "were in place when Perl read the file to parse the source. Normally that "
1668 "means that the file is being read bytewise, as if it were encoded in "
1669 "Latin-1, but there are two major ways for it to be otherwise. Firstly, if "
1670 "the CW<\\*(C`_\\|_END_\\|_\\*(C'>/CW<\\*(C`_\\|_DATA_\\|_\\*(C'> token is in "
1671 "the scope of a CW<\\*(C`use utf8\\*(C'> pragma then the CW<\\*(C`DATA\\*(C'> "
1672 "handle will be in UTF-8 mode. And secondly, if the source is being read "
1673 "from perl's standard input then the CW<\\*(C`DATA\\*(C'> file handle is "
1674 "actually aliased to the CW<\\*(C`STDIN\\*(C'> file handle, and may be in "
1675 "UTF-8 mode because of the CW<\\*(C`PERL_UNICODE\\*(C'> environment variable "
1676 "or perl's command-line switches."
1677 msgstr ""
1678
1679 #. type: Plain text
1680 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1681 #: opensuse-leap-16-1 opensuse-tumbleweed
1682 msgid ""
1683 "See SelfLoader for more description of _\\|_DATA_\\|_, and an example of its "
1684 "use. Note that you cannot read from the DATA filehandle in a BEGIN block: "
1685 "the BEGIN block is executed as soon as it is seen (during compilation), at "
1686 "which point the corresponding _\\|_DATA_\\|_ (or _\\|_END_\\|_) token has "
1687 "not yet been seen."
1688 msgstr ""
1689
1690 #. type: Plain text
1691 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1692 #: opensuse-leap-16-1 opensuse-tumbleweed
1693 msgid "I<Barewords>"
1694 msgstr ""
1695
1696 #. type: IX
1697 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1698 #: opensuse-leap-16-1 opensuse-tumbleweed
1699 #, no-wrap
1700 msgid "bareword"
1701 msgstr ""
1702
1703 #. type: IX
1704 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1705 #: opensuse-leap-16-1 opensuse-tumbleweed
1706 #, no-wrap
1707 msgid "Barewords"
1708 msgstr ""
1709
1710 #. type: Plain text
1711 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1712 #: opensuse-leap-16-1 opensuse-tumbleweed
1713 msgid ""
1714 "A word that has no other interpretation in the grammar will be treated as if "
1715 "it were a quoted string. These are known as \"barewords\". As with "
1716 "filehandles and labels, a bareword that consists entirely of lowercase "
1717 "letters risks conflict with future reserved words, and if you use the "
1718 "CW<\\*(C`use warnings\\*(C'> pragma or the B<-w> switch, Perl will warn you "
1719 "about any such words. Perl limits barewords (like identifiers) to about 250 "
1720 "characters. Future versions of Perl are likely to eliminate these arbitrary "
1721 "limitations."
1722 msgstr ""
1723
1724 #. type: Plain text
1725 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1726 #: opensuse-leap-16-1 opensuse-tumbleweed
1727 msgid "Some people may wish to outlaw barewords entirely. If you say"
1728 msgstr ""
1729
1730 #. type: Plain text
1731 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1732 #: opensuse-leap-16-1 opensuse-tumbleweed
1733 #, no-wrap
1734 msgid "\\& use strict \\*(Aqsubs\\*(Aq;\n"
1735 msgstr ""
1736
1737 #. type: Plain text
1738 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1739 #: opensuse-leap-16-1 opensuse-tumbleweed
1740 msgid ""
1741 "then any bareword that would NOT be interpreted as a subroutine call "
1742 "produces a compile-time error instead. The restriction lasts to the end of "
1743 "the enclosing block. An inner block may countermand this by saying "
1744 "CW<\\*(C`no strict \\*(Aqsubs\\*(Aq\\*(C'>."
1745 msgstr ""
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 "I<Array Interpolation>"
1751 msgstr ""
1752
1753 #. type: IX
1754 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1755 #: opensuse-leap-16-1 opensuse-tumbleweed
1756 #, no-wrap
1757 msgid "array, interpolation interpolation, array $\""
1758 msgstr ""
1759
1760 #. type: IX
1761 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1762 #: opensuse-leap-16-1 opensuse-tumbleweed
1763 #, no-wrap
1764 msgid "Array Interpolation"
1765 msgstr ""
1766
1767 #. type: Plain text
1768 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1769 #: opensuse-leap-16-1 opensuse-tumbleweed
1770 msgid ""
1771 "Arrays and slices are interpolated into double-quoted strings by joining the "
1772 "elements with the delimiter specified in the CW<$\"> variable "
1773 "(CW<$LIST_SEPARATOR> if \"use English;\" is specified), space by default. "
1774 "The following are equivalent:"
1775 msgstr ""
1776
1777 #. type: Plain text
1778 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1779 #: opensuse-leap-16-1 opensuse-tumbleweed
1780 #, no-wrap
1781 msgid ""
1782 "\\& $temp = join($\", @ARGV);\n"
1783 "\\& system \"echo $temp\";\n"
1784 "\\&\n"
1785 "\\& system \"echo @ARGV\";\n"
1786 msgstr ""
1787
1788 #. type: Plain text
1789 #: debian-trixie debian-unstable
1790 msgid ""
1791 "Within search patterns (which also undergo double-quotish substitution) "
1792 "there is an unfortunate ambiguity: Is CW<\\*(C`/$foo[bar]/\\*(C'> to be "
1793 "interpreted as \\&CW<\\*(C`/${foo}[bar]/\\*(C'> (where CW<\\*(C`[bar]\\*(C'> "
1794 "is a character class for the regular expression) or as CW<\\*(C`/${foo[bar]}/"
1795 "\\*(C'> (where CW<\\*(C`[bar]\\*(C'> is the subscript to array \\&CW<@foo>)? "
1796 "If CW<@foo> doesn't otherwise exist, then it's obviously a character class. "
1797 "If CW<@foo> exists, Perl takes a good guess about CW<\\*(C`[bar]\\*(C'>, and "
1798 "is almost always right. If it does guess wrong, or if you're just plain "
1799 "paranoid, you can force the correct interpretation with curly braces as "
1800 "above."
1801 msgstr ""
1802
1803 #. type: Plain text
1804 #: debian-trixie debian-unstable
1805 msgid ""
1806 "If you're looking for the information on how to use here-documents, which "
1807 "used to be here, that's been moved to \"Quote and Quote-like Operators\" in "
1808 "perlop."
1809 msgstr ""
1810
1811 #. type: IX
1812 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1813 #: opensuse-leap-16-1 opensuse-tumbleweed
1814 #, no-wrap
1815 msgid "List value constructors"
1816 msgstr ""
1817
1818 #. type: IX
1819 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1820 #: opensuse-leap-16-1 opensuse-tumbleweed
1821 #, no-wrap
1822 msgid "list"
1823 msgstr ""
1824
1825 #. type: Plain text
1826 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1827 #: opensuse-leap-16-1 opensuse-tumbleweed
1828 msgid ""
1829 "List values are denoted by separating individual values by commas (and "
1830 "enclosing the list in parentheses where precedence requires it):"
1831 msgstr ""
1832
1833 #. type: Plain text
1834 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1835 #: opensuse-leap-16-1 opensuse-tumbleweed
1836 #, no-wrap
1837 msgid "\\& (LIST)\n"
1838 msgstr ""
1839
1840 #. type: Plain text
1841 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1842 #: opensuse-leap-16-1 opensuse-tumbleweed
1843 msgid ""
1844 "In a context not requiring a list value, the value of what appears to be a "
1845 "list literal is simply the value of the final element, as with the C comma "
1846 "operator. For example,"
1847 msgstr ""
1848
1849 #. type: Plain text
1850 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1851 #: opensuse-leap-16-1 opensuse-tumbleweed
1852 #, no-wrap
1853 msgid "\\& @foo = (\\*(Aqcc\\*(Aq, \\*(Aq-E\\*(Aq, $bar);\n"
1854 msgstr ""
1855
1856 #. type: Plain text
1857 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1858 #: opensuse-leap-16-1 opensuse-tumbleweed
1859 msgid "assigns the entire list value to array CW<@foo>, but"
1860 msgstr ""
1861
1862 #. type: Plain text
1863 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1864 #: opensuse-leap-16-1 opensuse-tumbleweed
1865 #, no-wrap
1866 msgid "\\& $foo = (\\*(Aqcc\\*(Aq, \\*(Aq-E\\*(Aq, $bar);\n"
1867 msgstr ""
1868
1869 #. type: Plain text
1870 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1871 #: opensuse-leap-16-1 opensuse-tumbleweed
1872 msgid ""
1873 "assigns the value of variable CW<$bar> to the scalar variable CW<$foo>. "
1874 "Note that the value of an actual array in scalar context is the length of "
1875 "the array; the following assigns the value 3 to CW<$foo:>"
1876 msgstr ""
1877
1878 #. type: Plain text
1879 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1880 #: opensuse-leap-16-1 opensuse-tumbleweed
1881 #, no-wrap
1882 msgid ""
1883 "\\& @foo = (\\*(Aqcc\\*(Aq, \\*(Aq-E\\*(Aq, $bar);\n"
1884 "\\& $foo = @foo; # $foo gets 3\n"
1885 msgstr ""
1886
1887 #. type: Plain text
1888 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1889 #: opensuse-leap-16-1 opensuse-tumbleweed
1890 msgid ""
1891 "You may have an optional comma before the closing parenthesis of a list "
1892 "literal, so that you can say:"
1893 msgstr ""
1894
1895 #. type: Plain text
1896 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1897 #: opensuse-leap-16-1 opensuse-tumbleweed
1898 #, no-wrap
1899 msgid ""
1900 "\\& @foo = (\n"
1901 "\\& 1,\n"
1902 "\\& 2,\n"
1903 "\\& 3,\n"
1904 "\\& );\n"
1905 msgstr ""
1906
1907 #. type: Plain text
1908 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1909 #: opensuse-leap-16-1 opensuse-tumbleweed
1910 msgid ""
1911 "To use a here-document to assign an array, one line per element, you might "
1912 "use an approach like this:"
1913 msgstr ""
1914
1915 #. type: Plain text
1916 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1917 #: opensuse-leap-16-1 opensuse-tumbleweed
1918 #, no-wrap
1919 msgid ""
1920 "\\& @sauces = E<lt>E<lt>End_Lines =~ m/(\\eS.*\\eS)/g;\n"
1921 "\\& normal tomato\n"
1922 "\\& spicy tomato\n"
1923 "\\& green chile\n"
1924 "\\& pesto\n"
1925 "\\& white wine\n"
1926 "\\& End_Lines\n"
1927 msgstr ""
1928
1929 #. type: Plain text
1930 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1931 #: opensuse-leap-16-1 opensuse-tumbleweed
1932 msgid ""
1933 "LISTs do automatic interpolation of sublists. That is, when a LIST is "
1934 "evaluated, each element of the list is evaluated in list context, and the "
1935 "resulting list value is interpolated into LIST just as if each individual "
1936 "element were a member of LIST. Thus arrays and hashes lose their identity "
1937 "in a LIST--the list"
1938 msgstr ""
1939
1940 #. type: Plain text
1941 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1942 #: opensuse-leap-16-1 opensuse-tumbleweed
1943 #, no-wrap
1944 msgid "\\& (@foo,@bar,&SomeSub,%glarch)\n"
1945 msgstr ""
1946
1947 #. type: Plain text
1948 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1949 #: opensuse-leap-16-1 opensuse-tumbleweed
1950 msgid ""
1951 "contains all the elements of CW<@foo> followed by all the elements of "
1952 "CW<@bar>, followed by all the elements returned by the subroutine named "
1953 "SomeSub called in list context, followed by the key/value pairs of "
1954 "CW<%glarch>. To make a list reference that does I<NOT> interpolate, see "
1955 "perlref."
1956 msgstr ""
1957
1958 #. type: Plain text
1959 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1960 #: opensuse-leap-16-1 opensuse-tumbleweed
1961 msgid ""
1962 "The null list is represented by (). Interpolating it in a list has no "
1963 "effect. Thus ((),(),()) is equivalent to (). Similarly, interpolating an "
1964 "array with no elements is the same as if no array had been interpolated at "
1965 "that point."
1966 msgstr ""
1967
1968 #. type: Plain text
1969 #: debian-trixie debian-unstable
1970 msgid ""
1971 "This interpolation combines with the facts that the opening and closing "
1972 "parentheses are optional (except when necessary for precedence) and lists "
1973 "may end with an optional comma to mean that multiple commas within lists are "
1974 "legal syntax. The list CW<\\*(C`1,,3\\*(C'> is a concatenation of two "
1975 "lists, CW<\\*(C`1,\\*(C'> and CW<3>, the first of which ends with that "
1976 "optional comma. CW<\\*(C`1,,3\\*(C'> is CW<\\*(C`(1,),(3)\\*(C'> is "
1977 "CW<\\*(C`1,3\\*(C'> (And similarly for CW<\\*(C`1,,,3\\*(C'> is "
1978 "CW<\\*(C`(1,),(,),3\\*(C'> is CW<\\*(C`1,3\\*(C'> and so on.) Not that we'd "
1979 "advise you to use this obfuscation."
1980 msgstr ""
1981
1982 #. type: Plain text
1983 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1984 #: opensuse-leap-16-1 opensuse-tumbleweed
1985 msgid ""
1986 "A list value may also be subscripted like a normal array. You must put the "
1987 "list in parentheses to avoid ambiguity. For example:"
1988 msgstr ""
1989
1990 #. type: Plain text
1991 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
1992 #: opensuse-leap-16-1 opensuse-tumbleweed
1993 #, no-wrap
1994 msgid ""
1995 "\\& # Stat returns list value.\n"
1996 "\\& $time = (stat($file))[8];\n"
1997 "\\&\n"
1998 "\\& # SYNTAX ERROR HERE.\n"
1999 "\\& $time = stat($file)[8]; # OOPS, FORGOT PARENTHESES\n"
2000 "\\&\n"
2001 "\\& # Find a hex digit.\n"
2002 "\\& $hexdigit = (\\*(Aqa\\*(Aq,\\*(Aqb\\*(Aq,\\*(Aqc\\*(Aq,\\*(Aqd\\*(Aq,\\*(Aqe\\*(Aq,\\*(Aqf\\*(Aq)[$digit-10];\n"
2003 "\\&\n"
2004 "\\& # A \"reverse comma operator\".\n"
2005 "\\& return (pop(@foo),pop(@foo))[0];\n"
2006 msgstr ""
2007
2008 #. type: Plain text
2009 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2010 #: opensuse-leap-16-1 opensuse-tumbleweed
2011 msgid ""
2012 "Lists may be assigned to only when each element of the list is itself legal "
2013 "to assign to:"
2014 msgstr ""
2015
2016 #. type: Plain text
2017 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2018 #: opensuse-leap-16-1 opensuse-tumbleweed
2019 #, no-wrap
2020 msgid ""
2021 "\\& ($x, $y, $z) = (1, 2, 3);\n"
2022 "\\&\n"
2023 "\\& ($map{\\*(Aqred\\*(Aq}, $map{\\*(Aqblue\\*(Aq}, $map{\\*(Aqgreen\\*(Aq}) = (0x00f, 0x0f0, 0xf00);\n"
2024 msgstr ""
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 "An exception to this is that you may assign to CW<\\*(C`undef\\*(C'> in a "
2031 "list. This is useful for throwing away some of the return values of a "
2032 "function:"
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 #, no-wrap
2039 msgid "\\& ($dev, $ino, undef, undef, $uid, $gid) = stat($file);\n"
2040 msgstr ""
2041
2042 #. type: Plain text
2043 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2044 #: opensuse-leap-16-1 opensuse-tumbleweed
2045 msgid ""
2046 "As of Perl 5.22, you can also use CW<\\*(C`(undef)x2\\*(C'> instead of "
2047 "CW<\\*(C`undef, undef\\*(C'>. (You can also do CW<\\*(C`($x) x 2\\*(C'>, "
2048 "which is less useful, because it assigns to the same variable twice, "
2049 "clobbering the first value assigned.)"
2050 msgstr ""
2051
2052 #. type: Plain text
2053 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2054 #: opensuse-leap-16-1 opensuse-tumbleweed
2055 msgid ""
2056 "When you assign a list of scalars to an array, all previous values in that "
2057 "array are wiped out and the number of elements in the array will now be "
2058 "equal to the number of elements in the right-hand list -- the list from "
2059 "which assignment was made. The array will automatically resize itself to "
2060 "precisely accommodate each element in the right-hand list."
2061 msgstr ""
2062
2063 #. type: Plain text
2064 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2065 #: opensuse-leap-16-1 opensuse-tumbleweed
2066 #, no-wrap
2067 msgid ""
2068 "\\& use warnings;\n"
2069 "\\& my (@xyz, $x, $y, $z);\n"
2070 "\\&\n"
2071 "\\& @xyz = (1, 2, 3);\n"
2072 "\\& print \"@xyz\\en\"; # 1 2 3\n"
2073 "\\&\n"
2074 "\\& @xyz = (\\*(Aqal\\*(Aq, \\*(Aqbe\\*(Aq, \\*(Aqga\\*(Aq, \\*(Aqde\\*(Aq);\n"
2075 "\\& print \"@xyz\\en\"; # al be ga de\n"
2076 "\\&\n"
2077 "\\& @xyz = (101, 102);\n"
2078 "\\& print \"@xyz\\en\"; # 101 102\n"
2079 msgstr ""
2080
2081 #. type: Plain text
2082 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2083 #: opensuse-leap-16-1 opensuse-tumbleweed
2084 msgid ""
2085 "When, however, you assign a list of scalars to another list of scalars, the "
2086 "results differ according to whether the left-hand list -- the list being "
2087 "assigned to -- has the same, more or fewer elements than the right-hand list."
2088 msgstr ""
2089
2090 #. type: Plain text
2091 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2092 #: opensuse-leap-16-1 opensuse-tumbleweed
2093 #, no-wrap
2094 msgid ""
2095 "\\& ($x, $y, $z) = (1, 2, 3);\n"
2096 "\\& print \"$x $y $z\\en\"; # 1 2 3\n"
2097 "\\&\n"
2098 "\\& ($x, $y, $z) = (\\*(Aqal\\*(Aq, \\*(Aqbe\\*(Aq, \\*(Aqga\\*(Aq, \\*(Aqde\\*(Aq);\n"
2099 "\\& print \"$x $y $z\\en\"; # al be ga\n"
2100 "\\&\n"
2101 "\\& ($x, $y, $z) = (101, 102);\n"
2102 "\\& print \"$x $y $z\\en\"; # 101 102\n"
2103 "\\& # Use of uninitialized value $z in concatenation (.)\n"
2104 "\\& # or string at [program] line [line number].\n"
2105 msgstr ""
2106
2107 #. type: Plain text
2108 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2109 #: opensuse-leap-16-1 opensuse-tumbleweed
2110 msgid ""
2111 "If the number of scalars in the left-hand list is less than that in the "
2112 "right-hand list, the \"extra\" scalars in the right-hand list will simply "
2113 "not be assigned."
2114 msgstr ""
2115
2116 #. type: Plain text
2117 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2118 #: opensuse-leap-16-1 opensuse-tumbleweed
2119 msgid ""
2120 "If the number of scalars in the left-hand list is greater than that in the "
2121 "left-hand list, the \"missing\" scalars will become undefined."
2122 msgstr ""
2123
2124 #. type: Plain text
2125 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2126 #: opensuse-leap-16-1 opensuse-tumbleweed
2127 #, no-wrap
2128 msgid ""
2129 "\\& ($x, $y, $z) = (101, 102);\n"
2130 "\\& for my $el ($x, $y, $z) {\n"
2131 "\\& (defined $el) ? print \"$el \" : print \"E<lt>undefE<gt>\";\n"
2132 "\\& }\n"
2133 "\\& print \"\\en\";\n"
2134 "\\& # 101 102 E<lt>undefE<gt>\n"
2135 msgstr ""
2136
2137 #. type: Plain text
2138 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2139 #: opensuse-leap-16-1 opensuse-tumbleweed
2140 msgid ""
2141 "List assignment in scalar context returns the number of elements produced by "
2142 "the expression on the right side of the assignment:"
2143 msgstr ""
2144
2145 #. type: Plain text
2146 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2147 #: opensuse-leap-16-1 opensuse-tumbleweed
2148 #, no-wrap
2149 msgid ""
2150 "\\& $x = (($foo,$bar) = (3,2,1)); # set $x to 3, not 2\n"
2151 "\\& $x = (($foo,$bar) = f()); # set $x to f()\\*(Aqs return count\n"
2152 msgstr ""
2153
2154 #. type: Plain text
2155 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2156 #: opensuse-leap-16-1 opensuse-tumbleweed
2157 msgid ""
2158 "This is handy when you want to do a list assignment in a Boolean context, "
2159 "because most list functions return a null list when finished, which when "
2160 "assigned produces a 0, which is interpreted as FALSE."
2161 msgstr ""
2162
2163 #. type: Plain text
2164 #: debian-trixie debian-unstable
2165 msgid ""
2166 "It's also the source of a useful idiom for executing a function or "
2167 "performing an operation in list context and then counting the number of "
2168 "return values, by assigning to an empty list and then using that assignment "
2169 "in scalar context. For example, this code:"
2170 msgstr ""
2171
2172 #. type: Plain text
2173 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2174 #: opensuse-leap-16-1 opensuse-tumbleweed
2175 #, no-wrap
2176 msgid "\\& $count = () = $string =~ /\\ed+/g;\n"
2177 msgstr ""
2178
2179 #. type: Plain text
2180 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2181 #: opensuse-leap-16-1 opensuse-tumbleweed
2182 msgid ""
2183 "will place into CW<$count> the number of digit groups found in CW<$string>. "
2184 "This happens because the pattern match is in list context (since it is being "
2185 "assigned to the empty list), and will therefore return a list of all "
2186 "matching parts of the string. The list assignment in scalar context will "
2187 "translate that into the number of elements (here, the number of times the "
2188 "pattern matched) and assign that to CW<$count>. Note that simply using"
2189 msgstr ""
2190
2191 #. type: Plain text
2192 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2193 #: opensuse-leap-16-1 opensuse-tumbleweed
2194 #, no-wrap
2195 msgid "\\& $count = $string =~ /\\ed+/g;\n"
2196 msgstr ""
2197
2198 #. type: Plain text
2199 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2200 #: opensuse-leap-16-1 opensuse-tumbleweed
2201 msgid ""
2202 "would not have worked, since a pattern match in scalar context will only "
2203 "return true or false, rather than a count of matches."
2204 msgstr ""
2205
2206 #. type: Plain text
2207 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2208 #: opensuse-leap-16-1 opensuse-tumbleweed
2209 msgid "The final element of a list assignment may be an array or a hash:"
2210 msgstr ""
2211
2212 #. type: Plain text
2213 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2214 #: opensuse-leap-16-1 opensuse-tumbleweed
2215 #, no-wrap
2216 msgid ""
2217 "\\& ($x, $y, @rest) = split;\n"
2218 "\\& my($x, $y, %rest) = @_;\n"
2219 msgstr ""
2220
2221 #. type: Plain text
2222 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2223 #: opensuse-leap-16-1 opensuse-tumbleweed
2224 msgid ""
2225 "You can actually put an array or hash anywhere in the list, but the first "
2226 "one in the list will soak up all the values, and anything after it will "
2227 "become undefined. This may be useful in a B<my()> or B<local()>."
2228 msgstr ""
2229
2230 #. type: Plain text
2231 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2232 #: opensuse-leap-16-1 opensuse-tumbleweed
2233 msgid ""
2234 "A hash can be initialized using a literal list holding pairs of items to be "
2235 "interpreted as a key and a value:"
2236 msgstr ""
2237
2238 #. type: Plain text
2239 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2240 #: opensuse-leap-16-1 opensuse-tumbleweed
2241 #, no-wrap
2242 msgid ""
2243 "\\& # same as map assignment above\n"
2244 "\\& %map = (\\*(Aqred\\*(Aq,0x00f,\\*(Aqblue\\*(Aq,0x0f0,\\*(Aqgreen\\*(Aq,0xf00);\n"
2245 msgstr ""
2246
2247 #. type: Plain text
2248 #: debian-trixie debian-unstable
2249 msgid ""
2250 "While literal lists and named arrays are often interchangeable, that's not "
2251 "the case for hashes. Just because you can subscript a list value like a "
2252 "normal array does not mean that you can subscript a list value as a hash. "
2253 "Likewise, hashes included as parts of other lists (including parameters "
2254 "lists and return lists from functions) always flatten out into key/value "
2255 "pairs. That's why it's good to use references sometimes."
2256 msgstr ""
2257
2258 #. type: Plain text
2259 #: debian-trixie debian-unstable
2260 msgid ""
2261 "It is often more readable to use the CW<\\*(C`=E<gt>\\*(C'> operator between "
2262 "key/value pairs. The CW<\\*(C`=E<gt>\\*(C'> operator is mostly just a more "
2263 "visually distinctive synonym for a comma, but it also arranges for its left-"
2264 "hand operand to be interpreted as a string if it's a bareword that would be "
2265 "a legal simple identifier. CW<\\*(C`=E<gt>\\*(C'> doesn't quote compound "
2266 "identifiers, that contain double colons. This makes it nice for "
2267 "initializing hashes:"
2268 msgstr ""
2269
2270 #. type: Plain text
2271 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2272 #: opensuse-leap-16-1 opensuse-tumbleweed
2273 #, no-wrap
2274 msgid ""
2275 "\\& %map = (\n"
2276 "\\& red =E<gt> 0x00f,\n"
2277 "\\& blue =E<gt> 0x0f0,\n"
2278 "\\& green =E<gt> 0xf00,\n"
2279 "\\& );\n"
2280 msgstr ""
2281
2282 #. type: Plain text
2283 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2284 #: opensuse-leap-16-1 opensuse-tumbleweed
2285 msgid "or for initializing hash references to be used as records:"
2286 msgstr ""
2287
2288 #. type: Plain text
2289 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2290 #: opensuse-leap-16-1 opensuse-tumbleweed
2291 #, no-wrap
2292 msgid ""
2293 "\\& $rec = {\n"
2294 "\\& witch =E<gt> \\*(AqMable the Merciless\\*(Aq,\n"
2295 "\\& cat =E<gt> \\*(AqFluffy the Ferocious\\*(Aq,\n"
2296 "\\& date =E<gt> \\*(Aq10/31/1776\\*(Aq,\n"
2297 "\\& };\n"
2298 msgstr ""
2299
2300 #. type: Plain text
2301 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2302 #: opensuse-leap-16-1 opensuse-tumbleweed
2303 msgid "or for using call-by-named-parameter to complicated functions:"
2304 msgstr ""
2305
2306 #. type: Plain text
2307 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2308 #: opensuse-leap-16-1 opensuse-tumbleweed
2309 #, no-wrap
2310 msgid ""
2311 "\\& $field = $query-E<gt>radio_group(\n"
2312 "\\& name =E<gt> \\*(Aqgroup_name\\*(Aq,\n"
2313 "\\& values =E<gt> [\\*(Aqeenie\\*(Aq,\\*(Aqmeenie\\*(Aq,\\*(Aqminie\\*(Aq],\n"
2314 "\\& default =E<gt> \\*(Aqmeenie\\*(Aq,\n"
2315 "\\& linebreak =E<gt> \\*(Aqtrue\\*(Aq,\n"
2316 "\\& labels =E<gt> \\e%labels\n"
2317 "\\& );\n"
2318 msgstr ""
2319
2320 #. type: Plain text
2321 #: debian-trixie debian-unstable
2322 msgid ""
2323 "Note that just because a hash is initialized in that order doesn't mean that "
2324 "it comes out in that order. See \"sort\" in perlfunc for examples of how to "
2325 "arrange for an output ordering."
2326 msgstr ""
2327
2328 #. type: Plain text
2329 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2330 #: opensuse-leap-16-1 opensuse-tumbleweed
2331 msgid ""
2332 "If a key appears more than once in the initializer list of a hash, the last "
2333 "occurrence wins:"
2334 msgstr ""
2335
2336 #. type: Plain text
2337 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2338 #: opensuse-leap-16-1 opensuse-tumbleweed
2339 #, no-wrap
2340 msgid ""
2341 "\\& %circle = (\n"
2342 "\\& center =E<gt> [5, 10],\n"
2343 "\\& center =E<gt> [27, 9],\n"
2344 "\\& radius =E<gt> 100,\n"
2345 "\\& color =E<gt> [0xDF, 0xFF, 0x00],\n"
2346 "\\& radius =E<gt> 54,\n"
2347 "\\& );\n"
2348 "\\&\n"
2349 "\\& # same as\n"
2350 "\\& %circle = (\n"
2351 "\\& center =E<gt> [27, 9],\n"
2352 "\\& color =E<gt> [0xDF, 0xFF, 0x00],\n"
2353 "\\& radius =E<gt> 54,\n"
2354 "\\& );\n"
2355 msgstr ""
2356
2357 #. type: Plain text
2358 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2359 #: opensuse-leap-16-1 opensuse-tumbleweed
2360 msgid "This can be used to provide overridable configuration defaults:"
2361 msgstr ""
2362
2363 #. type: Plain text
2364 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2365 #: opensuse-leap-16-1 opensuse-tumbleweed
2366 #, no-wrap
2367 msgid ""
2368 "\\& # values in %args take priority over %config_defaults\n"
2369 "\\& %config = (%config_defaults, %args);\n"
2370 msgstr ""
2371
2372 #. type: IX
2373 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2374 #: opensuse-leap-16-1 opensuse-tumbleweed
2375 #, no-wrap
2376 msgid "Subscripts"
2377 msgstr ""
2378
2379 #. type: Plain text
2380 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2381 #: opensuse-leap-16-1 opensuse-tumbleweed
2382 msgid ""
2383 "An array can be accessed one scalar at a time by specifying a dollar sign "
2384 "(CW<\\*(C`$\\*(C'>), then the name of the array (without the leading "
2385 "CW<\\*(C`@\\*(C'>), then the subscript inside square brackets. For example:"
2386 msgstr ""
2387
2388 #. type: Plain text
2389 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2390 #: opensuse-leap-16-1 opensuse-tumbleweed
2391 #, no-wrap
2392 msgid ""
2393 "\\& @myarray = (5, 50, 500, 5000);\n"
2394 "\\& print \"The Third Element is\", $myarray[2], \"\\en\";\n"
2395 msgstr ""
2396
2397 #. type: Plain text
2398 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2399 #: opensuse-leap-16-1 opensuse-tumbleweed
2400 msgid ""
2401 "The array indices start with 0. A negative subscript retrieves its value "
2402 "from the end. In our example, CW<$myarray[-1]> would have been 5000, and "
2403 "CW<$myarray[-2]> would have been 500."
2404 msgstr ""
2405
2406 #. type: Plain text
2407 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2408 #: opensuse-leap-16-1 opensuse-tumbleweed
2409 msgid ""
2410 "Hash subscripts are similar, only instead of square brackets curly brackets "
2411 "are used. For example:"
2412 msgstr ""
2413
2414 #. type: Plain text
2415 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2416 #: opensuse-leap-16-1 opensuse-tumbleweed
2417 #, no-wrap
2418 msgid ""
2419 "\\& %scientists = \n"
2420 "\\& (\n"
2421 "\\& \"Newton\" =E<gt> \"Isaac\",\n"
2422 "\\& \"Einstein\" =E<gt> \"Albert\",\n"
2423 "\\& \"Darwin\" =E<gt> \"Charles\",\n"
2424 "\\& \"Feynman\" =E<gt> \"Richard\",\n"
2425 "\\& );\n"
2426 "\\&\n"
2427 "\\& print \"Darwin\\*(Aqs First Name is \", $scientists{\"Darwin\"}, \"\\en\";\n"
2428 msgstr ""
2429
2430 #. type: Plain text
2431 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2432 #: opensuse-leap-16-1 opensuse-tumbleweed
2433 msgid "You can also subscript a list to get a single element from it:"
2434 msgstr ""
2435
2436 #. type: Plain text
2437 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2438 #: opensuse-leap-16-1 opensuse-tumbleweed
2439 #, no-wrap
2440 msgid "\\& $dir = (getpwnam(\"daemon\"))[7];\n"
2441 msgstr ""
2442
2443 #. type: IX
2444 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2445 #: opensuse-leap-16-1 opensuse-tumbleweed
2446 #, no-wrap
2447 msgid "Multi-dimensional array emulation"
2448 msgstr ""
2449
2450 #. type: Plain text
2451 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2452 #: opensuse-leap-16-1 opensuse-tumbleweed
2453 msgid ""
2454 "Multidimensional arrays may be emulated by subscripting a hash with a list. "
2455 "The elements of the list are joined with the subscript separator (see \"$;\" "
2456 "in perlvar)."
2457 msgstr ""
2458
2459 #. type: Plain text
2460 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2461 #: opensuse-leap-16-1 opensuse-tumbleweed
2462 #, no-wrap
2463 msgid "\\& $foo{$x,$y,$z}\n"
2464 msgstr ""
2465
2466 #. type: Plain text
2467 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2468 #: opensuse-leap-16-1 opensuse-tumbleweed
2469 #, no-wrap
2470 msgid "\\& $foo{join($;, $x, $y, $z)}\n"
2471 msgstr ""
2472
2473 #. type: Plain text
2474 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2475 #: opensuse-leap-16-1 opensuse-tumbleweed
2476 msgid ""
2477 "The default subscript separator is \"\\e034\", the same as SUBSEP in B<awk>."
2478 msgstr ""
2479
2480 #. type: IX
2481 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2482 #: opensuse-leap-16-1 opensuse-tumbleweed
2483 #, no-wrap
2484 msgid "Slices"
2485 msgstr ""
2486
2487 #. type: IX
2488 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2489 #: opensuse-leap-16-1 opensuse-tumbleweed
2490 #, no-wrap
2491 msgid "slice array, slice hash, slice"
2492 msgstr ""
2493
2494 #. type: Plain text
2495 #: debian-trixie debian-unstable
2496 msgid ""
2497 "A slice accesses several elements of a list, an array, or a hash "
2498 "simultaneously using a list of subscripts. It's more convenient than "
2499 "writing out the individual elements as a list of separate scalar values."
2500 msgstr ""
2501
2502 #. type: Plain text
2503 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2504 #: opensuse-leap-16-1 opensuse-tumbleweed
2505 #, no-wrap
2506 msgid ""
2507 "\\& ($him, $her) = @folks[0,-1]; # array slice\n"
2508 "\\& @them = @folks[0 .. 3]; # array slice\n"
2509 "\\& ($who, $home) = @ENV{\"USER\", \"HOME\"}; # hash slice\n"
2510 "\\& ($uid, $dir) = (getpwnam(\"daemon\"))[2,7]; # list slice\n"
2511 msgstr ""
2512
2513 #. type: Plain text
2514 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2515 #: opensuse-leap-16-1 opensuse-tumbleweed
2516 msgid ""
2517 "Since you can assign to a list of variables, you can also assign to an array "
2518 "or hash slice."
2519 msgstr ""
2520
2521 #. type: Plain text
2522 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2523 #: opensuse-leap-16-1 opensuse-tumbleweed
2524 #, no-wrap
2525 msgid ""
2526 "\\& @days[3..5] = qw/Wed Thu Fri/;\n"
2527 "\\& @colors{\\*(Aqred\\*(Aq,\\*(Aqblue\\*(Aq,\\*(Aqgreen\\*(Aq} \n"
2528 "\\& = (0xff0000, 0x0000ff, 0x00ff00);\n"
2529 "\\& @folks[0, -1] = @folks[-1, 0];\n"
2530 msgstr ""
2531
2532 #. type: Plain text
2533 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2534 #: opensuse-leap-16-1 opensuse-tumbleweed
2535 msgid "The previous assignments are exactly equivalent to"
2536 msgstr ""
2537
2538 #. type: Plain text
2539 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2540 #: opensuse-leap-16-1 opensuse-tumbleweed
2541 #, no-wrap
2542 msgid ""
2543 "\\& ($days[3], $days[4], $days[5]) = qw/Wed Thu Fri/;\n"
2544 "\\& ($colors{\\*(Aqred\\*(Aq}, $colors{\\*(Aqblue\\*(Aq}, $colors{\\*(Aqgreen\\*(Aq})\n"
2545 "\\& = (0xff0000, 0x0000ff, 0x00ff00);\n"
2546 "\\& ($folks[0], $folks[-1]) = ($folks[-1], $folks[0]);\n"
2547 msgstr ""
2548
2549 #. type: Plain text
2550 #: debian-trixie debian-unstable
2551 msgid ""
2552 "Since changing a slice changes the original array or hash that it's slicing, "
2553 "a CW<\\*(C`foreach\\*(C'> construct will alter some--or even all--of the "
2554 "values of the array or hash."
2555 msgstr ""
2556
2557 #. type: Plain text
2558 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2559 #: opensuse-leap-16-1 opensuse-tumbleweed
2560 #, no-wrap
2561 msgid ""
2562 "\\& foreach (@array[ 4 .. 10 ]) { s/peter/paul/ } \n"
2563 "\\&\n"
2564 "\\& foreach (@hash{qw[key1 key2]}) {\n"
2565 "\\& s/^\\es+//; # trim leading whitespace\n"
2566 "\\& s/\\es+$//; # trim trailing whitespace\n"
2567 "\\& s/\\eb(\\ew)(\\ew*)\\eb/\\eu$1\\eL$2/g; # \"titlecase\" words\n"
2568 "\\& }\n"
2569 msgstr ""
2570
2571 #. type: Plain text
2572 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2573 #: opensuse-leap-16-1 opensuse-tumbleweed
2574 msgid ""
2575 "As a special exception, when you slice a list (but not an array or a hash), "
2576 "if the list evaluates to empty, then taking a slice of that empty list will "
2577 "always yield the empty list in turn. Thus:"
2578 msgstr ""
2579
2580 #. type: Plain text
2581 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2582 #: opensuse-leap-16-1 opensuse-tumbleweed
2583 #, no-wrap
2584 msgid ""
2585 "\\& @a = ()[0,1]; # @a has no elements\n"
2586 "\\& @b = (@a)[0,1]; # @b has no elements\n"
2587 "\\& @c = (sub{}-E<gt>())[0,1]; # @c has no elements\n"
2588 "\\& @d = (\\*(Aqa\\*(Aq,\\*(Aqb\\*(Aq)[0,1]; # @d has two elements\n"
2589 "\\& @e = (@d)[0,1,8,9]; # @e has four elements\n"
2590 "\\& @f = (@d)[8,9]; # @f has two elements\n"
2591 msgstr ""
2592
2593 #. type: Plain text
2594 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2595 #: opensuse-leap-16-1 opensuse-tumbleweed
2596 msgid ""
2597 "This makes it easy to write loops that terminate when a null list is "
2598 "returned:"
2599 msgstr ""
2600
2601 #. type: Plain text
2602 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2603 #: opensuse-leap-16-1 opensuse-tumbleweed
2604 #, no-wrap
2605 msgid ""
2606 "\\& while ( ($home, $user) = (getpwent)[7,0] ) {\n"
2607 "\\& printf \"%-8s %s\\en\", $user, $home;\n"
2608 "\\& }\n"
2609 msgstr ""
2610
2611 #. type: Plain text
2612 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2613 #: opensuse-leap-16-1 opensuse-tumbleweed
2614 msgid ""
2615 "As noted earlier in this document, the scalar sense of list assignment is "
2616 "the number of elements on the right-hand side of the assignment. The null "
2617 "list contains no elements, so when the password file is exhausted, the "
2618 "result is 0, not 2."
2619 msgstr ""
2620
2621 #. type: Plain text
2622 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2623 #: opensuse-leap-16-1 opensuse-tumbleweed
2624 msgid "Slices in scalar context return the last item of the slice."
2625 msgstr ""
2626
2627 #. type: Plain text
2628 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2629 #: opensuse-leap-16-1 opensuse-tumbleweed
2630 #, no-wrap
2631 msgid ""
2632 "\\& @a = qw/first second third/;\n"
2633 "\\& %h = (first =E<gt> \\*(AqA\\*(Aq, second =E<gt> \\*(AqB\\*(Aq);\n"
2634 "\\& $t = @a[0, 1]; # $t is now \\*(Aqsecond\\*(Aq\n"
2635 "\\& $u = @h{\\*(Aqfirst\\*(Aq, \\*(Aqsecond\\*(Aq}; # $u is now \\*(AqB\\*(Aq\n"
2636 msgstr ""
2637
2638 #. type: Plain text
2639 #: debian-trixie debian-unstable
2640 msgid ""
2641 "If you're confused about why you use an '@' there on a hash slice instead of "
2642 "a '%', think of it like this. The type of bracket (square or curly) governs "
2643 "whether it's an array or a hash being looked at. On the other hand, the "
2644 "leading symbol ('$' or '@') on the array or hash indicates whether you are "
2645 "getting back a singular value (a scalar) or a plural one (a list)."
2646 msgstr ""
2647
2648 #. type: Plain text
2649 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2650 #: opensuse-leap-16-1 opensuse-tumbleweed
2651 msgid "I<Key/Value Hash Slices>"
2652 msgstr ""
2653
2654 #. type: IX
2655 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2656 #: opensuse-leap-16-1 opensuse-tumbleweed
2657 #, no-wrap
2658 msgid "Key/Value Hash Slices"
2659 msgstr ""
2660
2661 #. type: Plain text
2662 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2663 #: opensuse-leap-16-1 opensuse-tumbleweed
2664 msgid ""
2665 "Starting in Perl 5.20, a hash slice operation with the % symbol is a variant "
2666 "of slice operation returning a list of key/value pairs rather than just "
2667 "values:"
2668 msgstr ""
2669
2670 #. type: Plain text
2671 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2672 #: opensuse-leap-16-1 opensuse-tumbleweed
2673 #, no-wrap
2674 msgid ""
2675 "\\& %h = (blonk =E<gt> 2, foo =E<gt> 3, squink =E<gt> 5, bar =E<gt> 8);\n"
2676 "\\& %subset = %h{\\*(Aqfoo\\*(Aq, \\*(Aqbar\\*(Aq}; # key/value hash slice\n"
2677 "\\& # %subset is now (foo =E<gt> 3, bar =E<gt> 8)\n"
2678 "\\& %removed = delete %h{\\*(Aqfoo\\*(Aq, \\*(Aqbar\\*(Aq};\n"
2679 "\\& # %removed is now (foo =E<gt> 3, bar =E<gt> 8)\n"
2680 "\\& # %h is now (blonk =E<gt> 2, squink =E<gt> 5)\n"
2681 msgstr ""
2682
2683 #. type: Plain text
2684 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2685 #: opensuse-leap-16-1 opensuse-tumbleweed
2686 msgid ""
2687 "However, the result of such a slice cannot be localized or assigned to. "
2688 "These are otherwise very much consistent with hash slices using the @ symbol."
2689 msgstr ""
2690
2691 #. type: Plain text
2692 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2693 #: opensuse-leap-16-1 opensuse-tumbleweed
2694 msgid "I<Index/Value Array Slices>"
2695 msgstr ""
2696
2697 #. type: IX
2698 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2699 #: opensuse-leap-16-1 opensuse-tumbleweed
2700 #, no-wrap
2701 msgid "Index/Value Array Slices"
2702 msgstr ""
2703
2704 #. type: Plain text
2705 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2706 #: opensuse-leap-16-1 opensuse-tumbleweed
2707 msgid ""
2708 "Similar to key/value hash slices (and also introduced in Perl 5.20), the % "
2709 "array slice syntax returns a list of index/value pairs:"
2710 msgstr ""
2711
2712 #. type: Plain text
2713 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2714 #: opensuse-leap-16-1 opensuse-tumbleweed
2715 #, no-wrap
2716 msgid ""
2717 "\\& @a = \"a\"..\"z\";\n"
2718 "\\& @list = %a[3,4,6];\n"
2719 "\\& # @list is now (3, \"d\", 4, \"e\", 6, \"g\")\n"
2720 "\\& @removed = delete %a[3,4,6]\n"
2721 "\\& # @removed is now (3, \"d\", 4, \"e\", 6, \"g\")\n"
2722 "\\& # @list[3,4,6] are now undef\n"
2723 msgstr ""
2724
2725 #. type: Plain text
2726 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2727 #: opensuse-leap-16-1 opensuse-tumbleweed
2728 msgid ""
2729 "Note that calling CW<\\*(C`delete\\*(C'> on array values is strongly "
2730 "discouraged."
2731 msgstr ""
2732
2733 #. type: IX
2734 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2735 #: opensuse-leap-16-1 opensuse-tumbleweed
2736 #, no-wrap
2737 msgid "Typeglobs and Filehandles"
2738 msgstr ""
2739
2740 #. type: IX
2741 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2742 #: opensuse-leap-16-1 opensuse-tumbleweed
2743 #, no-wrap
2744 msgid "typeglob filehandle *"
2745 msgstr ""
2746
2747 #. type: Plain text
2748 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2749 #: opensuse-leap-16-1 opensuse-tumbleweed
2750 msgid ""
2751 "Perl uses an internal type called a I<typeglob> to hold an entire symbol "
2752 "table entry. The type prefix of a typeglob is a CW<\\*(C`*\\*(C'>, because "
2753 "it represents all types. This used to be the preferred way to pass arrays "
2754 "and hashes by reference into a function, but now that we have real "
2755 "references, this is seldom needed."
2756 msgstr ""
2757
2758 #. type: Plain text
2759 #: debian-trixie debian-unstable
2760 msgid ""
2761 "The main use of typeglobs in modern Perl is create symbol table aliases. "
2762 "This assignment:"
2763 msgstr ""
2764
2765 #. type: Plain text
2766 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2767 #: opensuse-leap-16-1 opensuse-tumbleweed
2768 #, no-wrap
2769 msgid "\\& *this = *that;\n"
2770 msgstr ""
2771
2772 #. type: Plain text
2773 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2774 #: opensuse-leap-16-1 opensuse-tumbleweed
2775 msgid ""
2776 "makes CW<$this> an alias for CW<$that>, CW<@this> an alias for CW<@that>, "
2777 "CW<%this> an alias for CW<%that>, &this an alias for &that, etc. Much safer "
2778 "is to use a reference. This:"
2779 msgstr ""
2780
2781 #. type: Plain text
2782 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2783 #: opensuse-leap-16-1 opensuse-tumbleweed
2784 #, no-wrap
2785 msgid "\\& local *Here::blue = \\e$There::green;\n"
2786 msgstr ""
2787
2788 #. type: Plain text
2789 #: debian-trixie debian-unstable
2790 msgid ""
2791 "temporarily makes CW<$Here::blue> an alias for CW<$There::green>, but "
2792 "doesn't make CW<@Here::blue> an alias for CW<@There::green>, or "
2793 "CW<%Here::blue> an alias for \\&CW<%There::green>, etc. See \"Symbol "
2794 "Tables\" in perlmod for more examples of this. Strange though this may "
2795 "seem, this is the basis for the whole module import/export system."
2796 msgstr ""
2797
2798 #. type: Plain text
2799 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2800 #: opensuse-leap-16-1 opensuse-tumbleweed
2801 msgid ""
2802 "Another use for typeglobs is to pass filehandles into a function or to "
2803 "create new filehandles. If you need to use a typeglob to save away a "
2804 "filehandle, do it this way:"
2805 msgstr ""
2806
2807 #. type: Plain text
2808 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2809 #: opensuse-leap-16-1 opensuse-tumbleweed
2810 #, no-wrap
2811 msgid "\\& $fh = *STDOUT;\n"
2812 msgstr ""
2813
2814 #. type: Plain text
2815 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2816 #: opensuse-leap-16-1 opensuse-tumbleweed
2817 msgid "or perhaps as a real reference, like this:"
2818 msgstr ""
2819
2820 #. type: Plain text
2821 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2822 #: opensuse-leap-16-1 opensuse-tumbleweed
2823 #, no-wrap
2824 msgid "\\& $fh = \\e*STDOUT;\n"
2825 msgstr ""
2826
2827 #. type: Plain text
2828 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2829 #: opensuse-leap-16-1 opensuse-tumbleweed
2830 msgid ""
2831 "See perlsub for examples of using these as indirect filehandles in functions."
2832 msgstr ""
2833
2834 #. type: Plain text
2835 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2836 #: opensuse-leap-16-1 opensuse-tumbleweed
2837 msgid ""
2838 "Typeglobs are also a way to create a local filehandle using the B<local()> "
2839 "operator. These last until their block is exited, but may be passed back. "
2840 "For example:"
2841 msgstr ""
2842
2843 #. type: Plain text
2844 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2845 #: opensuse-leap-16-1 opensuse-tumbleweed
2846 #, no-wrap
2847 msgid ""
2848 "\\& sub newopen {\n"
2849 "\\& my $path = shift;\n"
2850 "\\& local *FH; # not my!\n"
2851 "\\& open (FH, $path) or return undef;\n"
2852 "\\& return *FH;\n"
2853 "\\& }\n"
2854 "\\& $fh = newopen(\\*(Aq/etc/passwd\\*(Aq);\n"
2855 msgstr ""
2856
2857 #. type: Plain text
2858 #: debian-trixie debian-unstable
2859 msgid ""
2860 "Now that we have the CW<*foo{THING}> notation, typeglobs aren't used as much "
2861 "for filehandle manipulations, although they're still needed to pass brand "
2862 "new file and directory handles into or out of functions. That's because "
2863 "\\&CW<*HANDLE{IO}> only works if HANDLE has already been used as a handle. "
2864 "In other words, CW<*FH> must be used to create new symbol table entries; "
2865 "\\&CW<*foo{THING}> cannot. When in doubt, use CW<*FH>."
2866 msgstr ""
2867
2868 #. type: Plain text
2869 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2870 #: opensuse-leap-16-1 opensuse-tumbleweed
2871 msgid ""
2872 "All functions that are capable of creating filehandles (B<open()>, "
2873 "\\&B<opendir()>, B<pipe()>, B<socketpair()>, B<sysopen()>, B<socket()>, and "
2874 "B<accept()>) automatically create an anonymous filehandle if the handle "
2875 "passed to them is an uninitialized scalar variable. This allows the "
2876 "constructs such as CW<\\*(C`open(my $fh, ...)\\*(C'> and CW<\\*(C`open(local "
2877 "$fh,...)\\*(C'> to be used to create filehandles that will conveniently be "
2878 "closed automatically when the scope ends, provided there are no other "
2879 "references to them. This largely eliminates the need for typeglobs when "
2880 "opening filehandles that must be passed around, as in the following example:"
2881 msgstr ""
2882
2883 #. type: Plain text
2884 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2885 #: opensuse-leap-16-1 opensuse-tumbleweed
2886 #, no-wrap
2887 msgid ""
2888 "\\& sub myopen {\n"
2889 "\\& open my $fh, \"@_\"\n"
2890 "\\& or die \"Can\\*(Aqt open \\*(Aq@_\\*(Aq: $!\";\n"
2891 "\\& return $fh;\n"
2892 "\\& }\n"
2893 "\\&\n"
2894 "\\& {\n"
2895 "\\& my $f = myopen(\"E<lt>/etc/motd\");\n"
2896 "\\& print E<lt>$fE<gt>;\n"
2897 "\\& # $f implicitly closed here\n"
2898 "\\& }\n"
2899 msgstr ""
2900
2901 #. type: Plain text
2902 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2903 #: opensuse-leap-16-1 opensuse-tumbleweed
2904 msgid ""
2905 "Note that if an initialized scalar variable is used instead the result is "
2906 "different: CW<\\*(C`my $fh=\\*(Aqzzz\\*(Aq; open($fh, ...)\\*(C'> is "
2907 "equivalent to CW<\\*(C`open( *{\\*(Aqzzz\\*(Aq}, ...)\\*(C'>. "
2908 "\\&CW<\\*(C`use strict \\*(Aqrefs\\*(Aq\\*(C'> forbids such practice."
2909 msgstr ""
2910
2911 #. type: Plain text
2912 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2913 #: opensuse-leap-16-1 opensuse-tumbleweed
2914 msgid ""
2915 "Another way to create anonymous filehandles is with the Symbol module or "
2916 "with the IO::Handle module and its ilk. These modules have the advantage of "
2917 "not hiding different types of the same name during the B<local()>. See the "
2918 "bottom of \"open\" in perlfunc for an example."
2919 msgstr ""
2920
2921 #. type: IX
2922 #: debian-trixie debian-unstable fedora-44 fedora-rawhide mageia-cauldron
2923 #: opensuse-leap-16-1 opensuse-tumbleweed
2924 #, no-wrap
2925 msgid "SEE ALSO"
2926 msgstr ""
2927
2928 #. type: Plain text
2929 #: debian-trixie debian-unstable
2930 msgid ""
2931 "See perlvar for a description of Perl's built-in variables and a discussion "
2932 "of legal variable names. See perlref, perlsub, and \"Symbol Tables\" in "
2933 "perlmod for more discussion on typeglobs and the CW<*foo{THING}> syntax."
2934 msgstr ""
2935
2936 #. type: TH
2937 #: debian-unstable
2938 #, no-wrap
2939 msgid "2025-11-16"
2940 msgstr ""
2941
2942 #. type: TH
2943 #: fedora-44 opensuse-leap-16-1 opensuse-tumbleweed
2944 #, no-wrap
2945 msgid "2026-03-09"
2946 msgstr ""
2947
2948 #. type: TH
2949 #: fedora-44 opensuse-leap-16-1 opensuse-tumbleweed
2950 #, no-wrap
2951 msgid "perl v5.42.1"
2952 msgstr ""
2953
2954 #. type: Plain text
2955 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
2956 #: opensuse-tumbleweed
2957 msgid ""
2958 "Values are usually referred to by name, or through a named reference. The "
2959 "first character of the name tells you to what sort of data structure it "
2960 "refers. This character is called a \"sigil\". The rest of the name tells "
2961 "you the particular value to which it refers. Usually this name is a single "
2962 "I<identifier>, that is, a string beginning with a letter or underscore, and "
2963 "containing letters, underscores, and digits. In some cases, it may be a "
2964 "chain of identifiers, separated by CW<\\*(C`::\\*(C'> (or by the deprecated "
2965 "CW<\\*(C`\\*(Aq\\*(C'>); all but the last are interpreted as names of "
2966 "packages, to locate the namespace in which to look up the final identifier "
2967 "(see \"Packages\" in perlmod for details). For a more in-depth discussion "
2968 "on identifiers, see \"Identifier parsing\". It\\*(Aqs possible to "
2969 "substitute for a simple identifier, an expression that produces a reference "
2970 "to the value at runtime. This is described in more detail below and in "
2971 "perlref. It is legal, but not recommended, to separate a variable\\*(Aqs "
2972 "sigil from its name by space and/or tab characters."
2973 msgstr ""
2974
2975 #. type: IX
2976 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
2977 #: opensuse-tumbleweed
2978 #, no-wrap
2979 msgid "identifier sigil"
2980 msgstr ""
2981
2982 #. type: Plain text
2983 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
2984 #: opensuse-tumbleweed
2985 msgid ""
2986 "Perl also has its own built-in variables whose names don\\*(Aqt follow these "
2987 "rules. They have strange names so they don\\*(Aqt accidentally collide with "
2988 "one of your normal variables. Strings that match parenthesized parts of a "
2989 "regular expression are saved under names containing only digits after the "
2990 "CW<\\*(C`$\\*(C'> (see perlop and perlre). In addition, several special "
2991 "variables that provide windows into the inner working of Perl have names "
2992 "containing punctuation characters. These are documented in perlvar."
2993 msgstr ""
2994
2995 #. type: Plain text
2996 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
2997 #: opensuse-tumbleweed
2998 msgid ""
2999 "Scalar values are always named with the sigil CW<\\*(Aq$\\*(Aq>, even when "
3000 "referring to a scalar that is part of an array or a hash. The CW<\\*(Aq$"
3001 "\\*(Aq> symbol works semantically like the English word \"the\" in that it "
3002 "indicates a single value is expected."
3003 msgstr ""
3004
3005 #. type: Plain text
3006 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
3007 #: opensuse-tumbleweed
3008 msgid ""
3009 "Entire arrays (and slices of arrays and hashes) are denoted by the sigil "
3010 "\\&CW<\\*(Aq@\\*(Aq>, which works much as the word \"these\" or \"those\" "
3011 "does in English, in that it indicates multiple values are expected."
3012 msgstr ""
3013
3014 #. type: Plain text
3015 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
3016 #: opensuse-tumbleweed
3017 msgid "Entire hashes are denoted by the sigil \\*(Aq%\\*(Aq:"
3018 msgstr ""
3019
3020 #. type: Plain text
3021 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
3022 #: opensuse-tumbleweed
3023 msgid ""
3024 "In addition, subroutines are named with an initial sigil CW<\\*(Aq&\\*(Aq>, "
3025 "though this is optional when unambiguous, just as the word \"do\" is often "
3026 "redundant in English. Symbol table entries can be named with an initial "
3027 "CW<\\*(Aq*\\*(Aq>, but you don\\*(Aqt really care about that yet (if "
3028 "ever :-)."
3029 msgstr ""
3030
3031 #. type: Plain text
3032 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
3033 #: opensuse-tumbleweed
3034 msgid ""
3035 "Every variable type has its own namespace, as do several non-variable "
3036 "identifiers. This means that you can, without fear of conflict, use the "
3037 "same name for a scalar variable, an array, or a hash--or, for that matter, "
3038 "for a filehandle, a directory handle, a subroutine name, a format name, or a "
3039 "label. This means that CW<$foo> and CW<@foo> are two different variables. "
3040 "It also means that CW<$foo[1]> is a part of CW<@foo>, not a part of "
3041 "CW<$foo>. This may seem a bit weird, but that\\*(Aqs okay, because it is "
3042 "weird."
3043 msgstr ""
3044
3045 #. type: Plain text
3046 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
3047 #: opensuse-tumbleweed
3048 msgid ""
3049 "Because variable references always start with the sigils CW<\\*(Aq$\\*(Aq>, "
3050 "CW<\\*(Aq@\\*(Aq>, or \\&CW<\\*(Aq%\\*(Aq>, the \"reserved\" words "
3051 "aren\\*(Aqt in fact reserved with respect to variable names. They I<are> "
3052 "reserved with respect to labels and filehandles, however, which don\\*(Aqt "
3053 "have an initial special character. You can\\*(Aqt have a filehandle named "
3054 "\"log\", for instance. Hint: you could say \\&CW<\\*(C`open(LOG,"
3055 "\\*(Aqlogfile\\*(Aq)\\*(C'> rather than CW<\\*(C`open(log,"
3056 "\\*(Aqlogfile\\*(Aq)\\*(C'>. Using uppercase filehandles also improves "
3057 "readability and protects you from conflict with future reserved words. Case "
3058 "I<is> significant--\"FOO\", \"Foo\", and \"foo\" are all different names. "
3059 "Names that start with a letter or underscore may also contain digits and "
3060 "underscores."
3061 msgstr ""
3062
3063 #. type: Plain text
3064 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
3065 #: opensuse-tumbleweed
3066 msgid ""
3067 "Names that start with a digit may contain only more digits. Names that do "
3068 "not start with a letter, underscore, digit or a caret are limited to one "
3069 "character, e.g., CW<$%> or \\&CW<$$>. (Most of these one character names "
3070 "have a predefined significance to Perl. For instance, CW<$$> is the current "
3071 "process id. And all such names are reserved for Perl\\*(Aqs possible use.)"
3072 msgstr ""
3073
3074 #. type: Plain text
3075 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
3076 #: opensuse-tumbleweed
3077 msgid ""
3078 "Up until Perl 5.18, the actual rules of what a valid identifier was were a "
3079 "bit fuzzy. However, in general, anything defined here should work on "
3080 "previous versions of Perl, while the opposite -- edge cases that work in "
3081 "previous versions, but aren\\*(Aqt defined here -- probably won\\*(Aqt work "
3082 "on newer versions. As an important side note, please note that the "
3083 "following only applies to bareword identifiers as found in Perl source code, "
3084 "not identifiers introduced through symbolic references, which have much "
3085 "fewer restrictions. If working under the effect of the CW<\\*(C`use "
3086 "utf8;\\*(C'> pragma, the following rules apply:"
3087 msgstr ""
3088
3089 #. type: Plain text
3090 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
3091 #: opensuse-tumbleweed
3092 msgid ""
3093 "There is one package separator in Perl: A double colon (CW<\\*(C`::"
3094 "\\*(C'>). Normal identifiers can start or end with a double colon, and can "
3095 "contain several parts delimited by double colons."
3096 msgstr ""
3097
3098 #. type: Plain text
3099 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
3100 #: opensuse-tumbleweed
3101 msgid ""
3102 "Previously you could use CW<\\*(C`\\*(Aq\\*(C'> as a package separator, this "
3103 "was removed in Perl 5.42."
3104 msgstr ""
3105
3106 #. type: Plain text
3107 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
3108 #: opensuse-tumbleweed
3109 msgid ""
3110 "Additionally, if the identifier is preceded by a sigil -- that is, if the "
3111 "identifier is part of a variable name -- it may optionally be enclosed in "
3112 "braces. For example, CW<\\*(C`${name}\\*(C'>, \\&CW<\\*(C`@{bigcats}\\*(C'>, "
3113 "CW<\\*(C`%{pizza_toppings}\\*(C'>."
3114 msgstr ""
3115
3116 #. type: Plain text
3117 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
3118 #: opensuse-tumbleweed
3119 #, no-wrap
3120 msgid ""
3121 "\\& /\n"
3122 "\\& (?(DEFINE)\n"
3123 "\\& (?E<lt>variableE<gt>\n"
3124 "\\& (?&sigil)\n"
3125 "\\& (?:\n"
3126 "\\& (?&normal_identifier)\n"
3127 "\\& | \\e{ \\es* (?&normal_identifier) \\es* \\e}\n"
3128 "\\& )\n"
3129 "\\& )\n"
3130 "\\& (?E<lt>normal_identifierE<gt>\n"
3131 "\\& (?: :: )*\n"
3132 "\\& (?&basic_identifier)\n"
3133 "\\& (?: (?= :: ) (?&normal_identifier) )?\n"
3134 "\\& (?: :: )*\n"
3135 "\\& )\n"
3136 "\\& (?E<lt>basic_identifierE<gt>\n"
3137 "\\& # is use utf8 on?\n"
3138 "\\& (?(?{ (caller(0))[8] & $utf8::hint_bits })\n"
3139 "\\& (?&Perl_XIDS) (?&Perl_XIDC)*\n"
3140 "\\& | (?aa) (?!\\ed) \\ew+\n"
3141 "\\& )\n"
3142 "\\& )\n"
3143 "\\& (?E<lt>sigilE<gt> \\e$\\e# | [&*\\e$\\e@%])\n"
3144 "\\& (?E<lt>Perl_XIDSE<gt> (?[ ( \\ep{Word} & \\ep{XID_Start} ) + [_] ]) )\n"
3145 "\\& (?E<lt>Perl_XIDCE<gt> (?[ \\ep{Word} & \\ep{XID_Continue} ]) )\n"
3146 "\\& )\n"
3147 "\\& /x\n"
3148 msgstr ""
3149
3150 #. type: Plain text
3151 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
3152 #: opensuse-tumbleweed
3153 msgid ""
3154 "Meanwhile, special identifiers don\\*(Aqt follow the above rules; For the "
3155 "most part, all of the identifiers in this category have a special meaning "
3156 "given by Perl. Because they have special parsing rules, these generally "
3157 "can\\*(Aqt be fully-qualified. They come in six forms (but don\\*(Aqt use "
3158 "forms 5 and 6):"
3159 msgstr ""
3160
3161 #. type: Plain text
3162 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
3163 #: opensuse-tumbleweed
3164 msgid ""
3165 "A sigil followed by a single character matching the "
3166 "CW<\\*(C`\\ep{POSIX_Punct}\\*(C'> property, like CW<$!> or CW<\\*(C`%+"
3167 "\\*(C'>, except the character CW<\"{\"> doesn\\*(Aqt work."
3168 msgstr ""
3169
3170 #. type: Plain text
3171 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
3172 #: opensuse-tumbleweed
3173 msgid ""
3174 "Note that an implication of this form is that there are identifiers only "
3175 "legal under CW<\"use\\ utf8\">, and vice-versa, for example the identifier "
3176 "\\&CW<$état> is legal under CW<\"use\\ utf8\">, but is otherwise considered "
3177 "to be the single character variable CW<$é> followed by the bareword "
3178 "CW<\"tat\">, the combination of which is a syntax error."
3179 msgstr ""
3180
3181 #. type: Plain text
3182 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
3183 #: opensuse-tumbleweed
3184 msgid ""
3185 "When you use the CW<\\*(C`use warnings\\*(C'> pragma or Perl\\*(Aqs B<-w> "
3186 "command-line option, you may see warnings about useless uses of constants or "
3187 "functions in \"void context\". Void context just means the value has been "
3188 "discarded, such as a statement containing only CW<\\*(C`\"fred\";\\*(C'> or "
3189 "CW<\\*(C`getpwuid(0);\\*(C'>. It still counts as scalar context for "
3190 "functions that care whether or not they\\*(Aqre being called in list context."
3191 msgstr ""
3192
3193 #. type: Plain text
3194 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
3195 #: opensuse-tumbleweed
3196 msgid ""
3197 "User-defined subroutines may choose to care whether they are being called in "
3198 "a void, scalar, or list context. Most subroutines do not need to bother, "
3199 "though. That\\*(Aqs because both scalars and lists are automatically "
3200 "interpolated into lists. See \"wantarray\" in perlfunc for how you would "
3201 "dynamically discern your function\\*(Aqs calling context."
3202 msgstr ""
3203
3204 #. type: Plain text
3205 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
3206 #: opensuse-tumbleweed
3207 msgid ""
3208 "Scalars aren\\*(Aqt necessarily one thing or another. There\\*(Aqs no place "
3209 "to declare a scalar variable to be of type \"string\", type \"number\", type "
3210 "\"reference\", or anything else. Because of the automatic conversion of "
3211 "scalars, operations that return scalars don\\*(Aqt need to care (and in "
3212 "fact, cannot care) whether their caller is looking for a string, a number, "
3213 "or a reference. Perl is a contextually polymorphic language whose scalars "
3214 "can be strings, numbers, or references (which includes objects). Although "
3215 "strings and numbers are considered pretty much the same thing for nearly all "
3216 "purposes, references are strongly-typed, uncastable pointers with builtin "
3217 "reference-counting and destructor invocation."
3218 msgstr ""
3219
3220 #. type: Plain text
3221 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
3222 #: opensuse-tumbleweed
3223 msgid ""
3224 "To find out whether a given string is a valid non-zero number, it\\*(Aqs "
3225 "sometimes enough to test it against both numeric 0 and also lexical \"0\" "
3226 "(although this will cause noises if warnings are on). That\\*(Aqs because "
3227 "strings that aren\\*(Aqt numbers count as 0, just as they do in B<awk>:"
3228 msgstr ""
3229
3230 #. type: Plain text
3231 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
3232 #: opensuse-tumbleweed
3233 msgid ""
3234 "That method may be best because otherwise you won\\*(Aqt treat IEEE "
3235 "notations like CW<\\*(C`NaN\\*(C'> or CW<\\*(C`Infinity\\*(C'> properly. At "
3236 "other times, you might prefer to determine whether string data can be used "
3237 "numerically by calling the B<POSIX::strtod()> function or by inspecting your "
3238 "string with a regular expression (as documented in perlre)."
3239 msgstr ""
3240
3241 #. type: Plain text
3242 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
3243 #: opensuse-tumbleweed
3244 msgid ""
3245 "The length of an array is a scalar value. You may find the length of array "
3246 "CW<@days> by evaluating CW<$#days>, as in B<csh>. However, this isn\\*(Aqt "
3247 "the length of the array; it\\*(Aqs the subscript of the last element, which "
3248 "is a different value since there is ordinarily a 0th element. Assigning to "
3249 "CW<$#days> actually changes the length of the array. Shortening an array "
3250 "this way destroys intervening values. Lengthening an array that was "
3251 "previously shortened does not recover values that were in those elements."
3252 msgstr ""
3253
3254 #. type: Plain text
3255 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
3256 #: opensuse-tumbleweed
3257 msgid ""
3258 "Prior to Perl 5.25 the value returned was a string consisting of the number "
3259 "of used buckets and the number of allocated buckets, separated by a slash. "
3260 "This is pretty much useful only to find out whether Perl\\*(Aqs internal "
3261 "hashing algorithm is performing poorly on your data set. For example, you "
3262 "stick 10,000 things in a hash, but evaluating \\&CW<%HASH> in scalar context "
3263 "reveals CW<\"1/16\">, which means only one out of sixteen buckets has been "
3264 "touched, and presumably contains all 10,000 of your items. This isn\\*(Aqt "
3265 "supposed to happen."
3266 msgstr ""
3267
3268 #. type: Plain text
3269 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
3270 #: opensuse-tumbleweed
3271 #, no-wrap
3272 msgid ""
3273 "\\& 12345\n"
3274 "\\& 12345.67\n"
3275 "\\& .23E-10 # a very small number\n"
3276 "\\& 3.14_15_92 # a very important number\n"
3277 "\\& 4_294_967_296 # underscore for legibility\n"
3278 "\\& 0xff # hex\n"
3279 "\\& 0xdead_beef # more hex\n"
3280 "\\& 0377 # octal (only numbers, begins with 0)\n"
3281 "\\& 0o12_345 # alternative octal (introduced in Perl 5.33.5)\n"
3282 "\\& 0b011011 # binary\n"
3283 "\\& 0x1.999ap-4 # hexadecimal floating point (the \\*(Aqp\\*(Aq is required)\n"
3284 "\\& 07.65p2 # octal floating point (the \\*(Aqp\\*(Aq is required)\n"
3285 "\\& 0o7.65p2 # alternative octal floating point\n"
3286 "\\& 0b101.01p-1 # binary floating point (the \\*(Aqp\\*(Aq is required)\n"
3287 msgstr ""
3288
3289 #. type: Plain text
3290 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
3291 #: opensuse-tumbleweed
3292 msgid ""
3293 "Hexadecimal, octal, or binary, representations in string literals (e.g. "
3294 "\\*(Aq0xff\\*(Aq) are not automatically converted to their integer "
3295 "representation. The B<hex()> and B<oct()> functions make these conversions "
3296 "for you. See \"hex\" in perlfunc and \"oct\" in perlfunc for more details."
3297 msgstr ""
3298
3299 #. type: Plain text
3300 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
3301 #: opensuse-tumbleweed
3302 msgid ""
3303 "Hexadecimal floating point can start just like a hexadecimal literal, and it "
3304 "can be followed by an optional fractional hexadecimal part, but it must be "
3305 "followed by CW<\\*(C`p\\*(C'>, an optional sign, and a power of two. The "
3306 "format is useful for accurately presenting floating point values, avoiding "
3307 "conversions to or from decimal floating point, and therefore avoiding "
3308 "possible loss in precision. Notice that while most current platforms use "
3309 "the 64-bit IEEE 754 floating point, not all do. Another potential source of "
3310 "(low-order) differences are the floating point rounding modes, which can "
3311 "differ between CPUs, operating systems, and compilers, and which Perl "
3312 "doesn\\*(Aqt control."
3313 msgstr ""
3314
3315 #. type: Plain text
3316 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
3317 #: opensuse-tumbleweed
3318 msgid ""
3319 "Octal and binary floating point numbers use the same format as hexadecimal "
3320 "floating point numbers, but limited to binary and octal digits, respectively."
3321 msgstr ""
3322
3323 #. type: Plain text
3324 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
3325 #: opensuse-tumbleweed
3326 msgid ""
3327 "Perl doesn\\*(Aqt understand CW<\\*(C`Inf\\*(C'> and CW<\\*(C`NaN\\*(C'> as "
3328 "numeric literals, but you can have them as strings, and Perl will convert "
3329 "them as needed: \"Inf\" + 1. (You can, however, import them from the POSIX "
3330 "extension; \\&CW<\\*(C`use POSIX qw(Inf NaN);\\*(C'> and then use them as "
3331 "literals.)"
3332 msgstr ""
3333
3334 #. type: Plain text
3335 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
3336 #: opensuse-tumbleweed
3337 msgid ""
3338 "Note that since Perl 5.8.1 the single-number v-strings (like "
3339 "CW<\\*(C`v65\\*(C'>) are not v-strings before the CW<\\*(C`=E<gt>\\*(C'> "
3340 "operator (which is usually used to separate a hash key from a hash value); "
3341 "instead they are interpreted as literal strings (\\*(Aqv65\\*(Aq). They "
3342 "were v-strings from Perl 5.6.0 to Perl 5.8.0, but that caused more confusion "
3343 "and breakage than good. Multi-number v-strings like CW<\\*(C`v65.66\\*(C'> "
3344 "and CW<65.66.67> continue to be v-strings always."
3345 msgstr ""
3346
3347 #. type: Plain text
3348 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
3349 #: opensuse-tumbleweed
3350 msgid ""
3351 "Text after _\\|_DATA_\\|_ may be read via the filehandle "
3352 "CW<\\*(C`PACKNAME::DATA\\*(C'>, where CW<\\*(C`PACKNAME\\*(C'> is the "
3353 "package that was current when the _\\|_DATA_\\|_ token was encountered. The "
3354 "filehandle is left open pointing to the line after _\\|_DATA_\\|_. The "
3355 "program should CW<\\*(C`close DATA\\*(C'> when it is done reading from it. "
3356 "(Leaving it open leaks filehandles if the module is reloaded for any reason, "
3357 "so it\\*(Aqs a safer practice to close it.) For compatibility with older "
3358 "scripts written before _\\|_DATA_\\|_ was introduced, _\\|_END_\\|_ behaves "
3359 "like _\\|_DATA_\\|_ in the top level script (but not in files loaded with "
3360 "CW<\\*(C`require\\*(C'> or CW<\\*(C`do\\*(C'>) and leaves the remaining "
3361 "contents of the file accessible via CW<\\*(C`main::DATA\\*(C'>."
3362 msgstr ""
3363
3364 #. type: Plain text
3365 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
3366 #: opensuse-tumbleweed
3367 msgid ""
3368 "The CW<\\*(C`DATA\\*(C'> file handle by default has whatever PerlIO layers "
3369 "were in place when Perl read the file to parse the source. Normally that "
3370 "means that the file is being read bytewise, as if it were encoded in "
3371 "Latin-1, but there are two major ways for it to be otherwise. Firstly, if "
3372 "the CW<\\*(C`_\\|_END_\\|_\\*(C'>/CW<\\*(C`_\\|_DATA_\\|_\\*(C'> token is in "
3373 "the scope of a CW<\\*(C`use utf8\\*(C'> pragma then the CW<\\*(C`DATA\\*(C'> "
3374 "handle will be in UTF-8 mode. And secondly, if the source is being read "
3375 "from perl\\*(Aqs standard input then the CW<\\*(C`DATA\\*(C'> file handle is "
3376 "actually aliased to the CW<\\*(C`STDIN\\*(C'> file handle, and may be in "
3377 "UTF-8 mode because of the CW<\\*(C`PERL_UNICODE\\*(C'> environment variable "
3378 "or perl\\*(Aqs command-line switches."
3379 msgstr ""
3380
3381 #. type: Plain text
3382 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
3383 #: opensuse-tumbleweed
3384 msgid ""
3385 "Within search patterns (which also undergo double-quotish substitution) "
3386 "there is an unfortunate ambiguity: Is CW<\\*(C`/$foo[bar]/\\*(C'> to be "
3387 "interpreted as \\&CW<\\*(C`/${foo}[bar]/\\*(C'> (where CW<\\*(C`[bar]\\*(C'> "
3388 "is a character class for the regular expression) or as CW<\\*(C`/${foo[bar]}/"
3389 "\\*(C'> (where CW<\\*(C`[bar]\\*(C'> is the subscript to array \\&CW<@foo>)? "
3390 "If CW<@foo> doesn\\*(Aqt otherwise exist, then it\\*(Aqs obviously a "
3391 "character class. If CW<@foo> exists, Perl takes a good guess about "
3392 "CW<\\*(C`[bar]\\*(C'>, and is almost always right. If it does guess wrong, "
3393 "or if you\\*(Aqre just plain paranoid, you can force the correct "
3394 "interpretation with curly braces as above."
3395 msgstr ""
3396
3397 #. type: Plain text
3398 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
3399 #: opensuse-tumbleweed
3400 msgid ""
3401 "If you\\*(Aqre looking for the information on how to use here-documents, "
3402 "which used to be here, that\\*(Aqs been moved to \"Quote and Quote-like "
3403 "Operators\" in perlop."
3404 msgstr ""
3405
3406 #. type: Plain text
3407 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
3408 #: opensuse-tumbleweed
3409 msgid ""
3410 "This interpolation combines with the facts that the opening and closing "
3411 "parentheses are optional (except when necessary for precedence) and lists "
3412 "may end with an optional comma to mean that multiple commas within lists are "
3413 "legal syntax. The list CW<\\*(C`1,,3\\*(C'> is a concatenation of two "
3414 "lists, CW<\\*(C`1,\\*(C'> and CW<3>, the first of which ends with that "
3415 "optional comma. CW<\\*(C`1,,3\\*(C'> is CW<\\*(C`(1,),(3)\\*(C'> is "
3416 "CW<\\*(C`1,3\\*(C'> (And similarly for CW<\\*(C`1,,,3\\*(C'> is "
3417 "CW<\\*(C`(1,),(,),3\\*(C'> is CW<\\*(C`1,3\\*(C'> and so on.) Not that "
3418 "we\\*(Aqd advise you to use this obfuscation."
3419 msgstr ""
3420
3421 #. type: Plain text
3422 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
3423 #: opensuse-tumbleweed
3424 msgid ""
3425 "It\\*(Aqs also the source of a useful idiom for executing a function or "
3426 "performing an operation in list context and then counting the number of "
3427 "return values, by assigning to an empty list and then using that assignment "
3428 "in scalar context. For example, this code:"
3429 msgstr ""
3430
3431 #. type: Plain text
3432 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
3433 #: opensuse-tumbleweed
3434 msgid ""
3435 "While literal lists and named arrays are often interchangeable, that\\*(Aqs "
3436 "not the case for hashes. Just because you can subscript a list value like a "
3437 "normal array does not mean that you can subscript a list value as a hash. "
3438 "Likewise, hashes included as parts of other lists (including parameters "
3439 "lists and return lists from functions) always flatten out into key/value "
3440 "pairs. That\\*(Aqs why it\\*(Aqs good to use references sometimes."
3441 msgstr ""
3442
3443 #. type: Plain text
3444 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
3445 #: opensuse-tumbleweed
3446 msgid ""
3447 "It is often more readable to use the CW<\\*(C`=E<gt>\\*(C'> operator between "
3448 "key/value pairs. The CW<\\*(C`=E<gt>\\*(C'> operator is mostly just a more "
3449 "visually distinctive synonym for a comma, but it also arranges for its left-"
3450 "hand operand to be interpreted as a string if it\\*(Aqs a bareword that "
3451 "would be a legal simple identifier. CW<\\*(C`=E<gt>\\*(C'> doesn\\*(Aqt "
3452 "quote compound identifiers, that contain double colons. This makes it nice "
3453 "for initializing hashes:"
3454 msgstr ""
3455
3456 #. type: Plain text
3457 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
3458 #: opensuse-tumbleweed
3459 msgid ""
3460 "Note that just because a hash is initialized in that order doesn\\*(Aqt mean "
3461 "that it comes out in that order. See \"sort\" in perlfunc for examples of "
3462 "how to arrange for an output ordering."
3463 msgstr ""
3464
3465 #. type: Plain text
3466 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
3467 #: opensuse-tumbleweed
3468 msgid ""
3469 "A slice accesses several elements of a list, an array, or a hash "
3470 "simultaneously using a list of subscripts. It\\*(Aqs more convenient than "
3471 "writing out the individual elements as a list of separate scalar values."
3472 msgstr ""
3473
3474 #. type: Plain text
3475 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
3476 #: opensuse-tumbleweed
3477 msgid ""
3478 "Since changing a slice changes the original array or hash that it\\*(Aqs "
3479 "slicing, a CW<\\*(C`foreach\\*(C'> construct will alter some--or even all--"
3480 "of the values of the array or hash."
3481 msgstr ""
3482
3483 #. type: Plain text
3484 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
3485 #: opensuse-tumbleweed
3486 msgid ""
3487 "If you\\*(Aqre confused about why you use an CW<\\*(Aq@\\*(Aq> there on a "
3488 "hash slice instead of a CW<\\*(Aq%\\*(Aq>, think of it like this. The type "
3489 "of bracket (square or curly) governs whether it\\*(Aqs an array or a hash "
3490 "being looked at. On the other hand, the leading symbol (CW<\\*(Aq$\\*(Aq> "
3491 "or CW<\\*(Aq@\\*(Aq>) on the array or hash indicates whether you are getting "
3492 "back a singular value (a scalar) or a plural one (a list)."
3493 msgstr ""
3494
3495 #. type: Plain text
3496 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
3497 #: opensuse-tumbleweed
3498 msgid ""
3499 "The main use of typeglobs in modern Perl is to create symbol table aliases. "
3500 "This assignment:"
3501 msgstr ""
3502
3503 #. type: Plain text
3504 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
3505 #: opensuse-tumbleweed
3506 msgid ""
3507 "temporarily makes CW<$Here::blue> an alias for CW<$There::green>, but "
3508 "doesn\\*(Aqt make CW<@Here::blue> an alias for CW<@There::green>, or "
3509 "CW<%Here::blue> an alias for \\&CW<%There::green>, etc. See \"Symbol "
3510 "Tables\" in perlmod for more examples of this. Strange though this may "
3511 "seem, this is the basis for the whole module import/export system."
3512 msgstr ""
3513
3514 #. type: Plain text
3515 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
3516 #: opensuse-tumbleweed
3517 msgid ""
3518 "Now that we have the CW<*foo{THING}> notation, typeglobs aren\\*(Aqt used as "
3519 "much for filehandle manipulations, although they\\*(Aqre still needed to "
3520 "pass brand new file and directory handles into or out of functions. "
3521 "That\\*(Aqs because \\&CW<*HANDLE{IO}> only works if HANDLE has already been "
3522 "used as a handle. In other words, CW<*FH> must be used to create new symbol "
3523 "table entries; \\&CW<*foo{THING}> cannot. When in doubt, use CW<*FH>."
3524 msgstr ""
3525
3526 #. type: Plain text
3527 #: fedora-44 fedora-rawhide mageia-cauldron opensuse-leap-16-1
3528 #: opensuse-tumbleweed
3529 msgid ""
3530 "See perlvar for a description of Perl\\*(Aqs built-in variables and a "
3531 "discussion of legal variable names. See perlref, perlsub, and \"Symbol "
3532 "Tables\" in perlmod for more discussion on typeglobs and the CW<*foo{THING}> "
3533 "syntax."
3534 msgstr ""
3535
3536 #. type: TH
3537 #: fedora-rawhide
3538 #, no-wrap
3539 msgid "2026-03-30"
3540 msgstr ""
3541
3542 #. type: TH
3543 #: fedora-rawhide
3544 #, no-wrap
3545 msgid "perl v5.42.2"
3546 msgstr ""
3547
3548 #. type: TH
3549 #: mageia-cauldron
3550 #, no-wrap
3551 msgid "2025-06-24"
3552 msgstr ""
3553
3554 #. type: TH
3555 #: mageia-cauldron
3556 #, no-wrap
3557 msgid "perl v5.42.0"
3558 msgstr ""