File: perlvar.html

package info (click to toggle)
perl-doc-html 5.26.0-4
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 39,400 kB
  • sloc: xml: 36; makefile: 7
file content (2560 lines) | stat: -rw-r--r-- 170,006 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
  <title>perlvar - perldoc.perl.org</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  <meta http-equiv="Content-Language" content="en-gb">
  <link rel="search" type="application/opensearchdescription+xml" title="Search perldoc.perl.org" href="/static/search.xml"/>
  <link href="static/css-20100830.css" rel="stylesheet" rev="stylesheet" type="text/css" media="screen">
  <link href="static/exploreperl.css" rel="stylesheet" rev="stylesheet" type="text/css">
</head>

<body onLoad="perldoc.startup();" onPageShow="if (event.persisted) perldoc.startup();">
    <div id="page">
      
      <div id="header">
	<div id="homepage_link">
	  <a href="index.html"></a>
	</div>
	<div id="strapline">
	  Perl Programming Documentation
	</div>
	<div id="download_link" class="download">
	  <a href="http://www.perl.org/get.html">Download Perl</a>
	</div>
	<div id="explore_link" class="download">
	  <a id="explore_anchor" href="#">Explore</a>
	</div>
      </div>
      
      <div id="body">
        <div id="left_column">
          <div class="side_group">
            
	    <div class="side_panel doc_panel">
              <p>Manual</p>
              <ul>
                <li><a href="index-overview.html">Overview</a>
                <li><a href="index-tutorials.html">Tutorials</a>
                <li><a href="index-faq.html">FAQs</a>
                <li><a href="index-history.html">History / Changes</a>
                <li><a href="index-licence.html">License</a>
              </ul>
            </div>
            <div class="side_panel doc_panel">
              <p>Reference</p>
              <ul>
                <li><a href="index-language.html">Language</a>
                <li><a href="index-functions.html">Functions</a>
                <li><a href="perlop.html">Operators</a>
                <li><a href="perlvar.html">Special Variables</a>
                <li><a href="index-pragmas.html">Pragmas</a>
                <li><a href="index-utilities.html">Utilities</a>
                <li><a href="index-internals.html">Internals</a>
                <li><a href="index-platforms.html">Platform Specific</a>
              </ul>
            </div>
            <div class="side_panel doc_panel">
              <p>Modules</p>
              <ul>
		<li>
		
                
                  
		    
		  
		
                  
		    
		  
		
                  
		    
		  
		
                  
		    
		  
		
                  
		    
		  
		
                  
		    
		  
		
                  
		    
		  
		
                  
		    
		  
		
                  
		    
		  
		
                  
		
                  
		
                  
		    
		  
		
                  
		    
		  
		
                  
		    
		  
		
                  
		    
		  
		
                  
		    
		  
		
                  
		
                  
		
                  
		    
		  
		
                  
		    
		  
		
                  
		    
		  
		
                  
		
                  
		
                  
		    
		  
		
                  
		
                  
		
		
                    <a href="index-modules-A.html">A</a>
                    
                      
                        &bull;
                      
                    
                
                    <a href="index-modules-B.html">B</a>
                    
                      
                        &bull;
                      
                    
                
                    <a href="index-modules-C.html">C</a>
                    
                      
                        &bull;
                      
                    
                
                    <a href="index-modules-D.html">D</a>
                    
                      
                        &bull;
                      
                    
                
                    <a href="index-modules-E.html">E</a>
                    
                      
                        <li>
                      
                    
                
                    <a href="index-modules-F.html">F</a>
                    
                      
                        &bull;
                      
                    
                
                    <a href="index-modules-G.html">G</a>
                    
                      
                        &bull;
                      
                    
                
                    <a href="index-modules-H.html">H</a>
                    
                      
                        &bull;
                      
                    
                
                    <a href="index-modules-I.html">I</a>
                    
                      
                        &bull;
                      
                    
                
                    <a href="index-modules-L.html">L</a>
                    
                      
                        <li>
                      
                    
                
                    <a href="index-modules-M.html">M</a>
                    
                      
                        &bull;
                      
                    
                
                    <a href="index-modules-N.html">N</a>
                    
                      
                        &bull;
                      
                    
                
                    <a href="index-modules-O.html">O</a>
                    
                      
                        &bull;
                      
                    
                
                    <a href="index-modules-P.html">P</a>
                    
                      
                        &bull;
                      
                    
                
                    <a href="index-modules-S.html">S</a>
                    
                      
                        <li>
                      
                    
                
                    <a href="index-modules-T.html">T</a>
                    
                      
                        &bull;
                      
                    
                
                    <a href="index-modules-U.html">U</a>
                    
                      
                        &bull;
                      
                    
                
                    <a href="index-modules-X.html">X</a>
                    
                
              </ul>
            </div>
            
	      <div class="side_panel doc_panel">
		<p>Tools</p>
		<ul>
		  <li><a href="preferences.html">Preferences</a>
		</ul>
	      </div>
            
          </div>
        </div>
        <div id="centre_column">
          <div id="content_header">
            <div id="title_bar">
              <div id="page_name">
                <h1>perlvar</h1>
              </div>
              <div id="perl_version">
                Perl 5 version 26.0 documentation
              </div>
              <div class="page_links" id="page_links_top">
                <a href="#" onClick="toolbar.goToTop();return false;">Go to top</a>
		
              </div>
	      <div class="page_links" id="page_links_bottom">
		
                  <a href="#" id="page_index_toggle">Show page index</a> &bull;
		
                <a href="#" id="recent_pages_toggle">Show recent pages</a>		
	      </div>
	      <div id="search_form">
		<form action="search.html" method="GET" id="search">
		  <input type="text" name="q" id="search_box" alt="Search">
		</form>
	      </div>
            </div>
            <div id="breadcrumbs">
                
    <a href="index.html">Home</a> &gt;
    
      
        <a href="index-language.html">Language reference</a> &gt;
      
    
    perlvar
  

            </div>
          </div>
          <div id="content_body">
	    <!--[if lt IE 7]>
 <div class="noscript">
   <p>
     <strong>It looks like you're using Internet Explorer 6. This is a very old
     browser which does not offer full support for modern websites.</strong>
   </p>
   <p>
     Unfortunately this means that this website will not work on
     your computer.
   </p>
   <p>
     Don't miss out though! To view the site (and get a better experience from
     many other websites), simply upgrade to
     <a href="http://www.microsoft.com/windows/Internet-explorer/default.aspx">Internet
Explorer 8</a>
     or download an alternative browser such as
     <a href="http://www.mozilla.com/en-US/firefox/firefox.html">Firefox</a>,
     <a href="http://www.apple.com/safari/download/">Safari</a>, or
     <a href="http://www.google.co.uk/chrome">Google Chrome</a>.
   </p>
   <p>
     All of these browsers are free. If you're using a PC at work, you may
     need to contact your IT administrator.
   </p>
 </div>
<![endif]-->
	    <noscript>
	      <div class="noscript">
	      <p>
                <strong>Please note: Many features of this site require JavaScript. You appear to have JavaScript disabled,
	        or are running a non-JavaScript capable web browser.</strong>
	      </p>
	      <p>
		To get the best experience, please enable JavaScript or download a modern web browser such as <a href="http://www.microsoft.com/windows/Internet-explorer/default.aspx">Internet Explorer 8</a>, <a href="http://www.mozilla.com/en-US/firefox/firefox.html">Firefox</a>, <a href="http://www.apple.com/safari/download/">Safari</a>, or <a href="http://www.google.co.uk/chrome">Google Chrome</a>.
              </p>
	      </div>
	    </noscript>

	    <div id="recent_pages" class="hud_container">
	      <div id="recent_pages_header" class="hud_header">
		<div id="recent_pages_close" class="hud_close"><a href="#" onClick="recentPages.hide();return false;"></a></div>
		<div id="recent_pages_title" class="hud_title"><span class="hud_span_top">Recently read</span></div>
		<div id="recent_pages_topright" class="hud_topright"></div>
	      </div>
	      <div id="recent_pages_content" class="hud_content">
	      </div>
	      <div id="recent_pages_footer" class="hud_footer">
		<div id="recent_pages_bottomleft" class="hud_bottomleft"></div>
		<div id="recent_pages_bottom" class="hud_bottom"><span class="hud_span_bottom"></span></div>
		<div id="recent_pages_resize" class="hud_resize"></div>
	      </div>
	    </div>
  
	    <div id="from_search"></div>
            <h1>perlvar</h1>


  <!--    -->
<ul><li><a href="#NAME">NAME</a><li><a href="#DESCRIPTION">DESCRIPTION</a><ul><li><a href="#The-Syntax-of-Variable-Names">The Syntax of Variable Names</a></ul><li><a href="#SPECIAL-VARIABLES">SPECIAL VARIABLES</a><ul><li><a href="#General-Variables">General Variables</a><li><a href="#Variables-related-to-regular-expressions">Variables related to regular expressions</a><li><a href="#Variables-related-to-filehandles">Variables related to filehandles</a><li><a href="#Error-Variables">Error Variables
 </a><li><a href="#Variables-related-to-the-interpreter-state">Variables related to the interpreter state</a><li><a href="#Deprecated-and-removed-variables">Deprecated and removed variables</a></ul></ul><a name="NAME"></a><h1>NAME</h1>
<p>perlvar - Perl predefined variables</p>
<a name="DESCRIPTION"></a><h1>DESCRIPTION</h1>
<a name="The-Syntax-of-Variable-Names"></a><h2>The Syntax of Variable Names</h2>
<p>Variable names in Perl can have several formats.  Usually, they
must begin with a letter or underscore, in which case they can be
arbitrarily long (up to an internal limit of 251 characters) and
may contain letters, digits, underscores, or the special sequence
<code class="inline"><span class="w">::</span></code>
 or <code class="inline">'</code>.  In this case, the part before the last <code class="inline"><span class="w">::</span></code>
 or
<code class="inline">'</code> is taken to be a <i>package qualifier</i>; see <a href="perlmod.html">perlmod</a>.
A Unicode letter that is not ASCII is not considered to be a letter
unless <code class="inline"><span class="q">&quot;use utf8&quot;</span></code>
 is in effect, and somewhat more complicated
rules apply; see <a href="perldata.html#Identifier-parsing">Identifier parsing in perldata</a> for details.</p>
<p>Perl variable names may also be a sequence of digits, a single
punctuation character, or the two-character sequence: <code class="inline">^</code> (caret or
CIRCUMFLEX ACCENT) followed by any one of the characters <code class="inline"><span class="s">[</span><span class="s">]</span><span class="s">[</span><span class="w">A</span>-<span class="w">Z</span>^<span class="w">_</span>?\<span class="s">]</span></code>
.
These names are all reserved for
special uses by Perl; for example, the all-digits names are used
to hold data captured by backreferences after a regular expression
match.</p>
<p>Since Perl v5.6.0, Perl variable names may also be alphanumeric strings
preceded by a caret.  These must all be written in the form <code class="inline"><span class="i">$</span>{<span class="w">^Foo</span>}</code>
;
the braces are not optional.  <code class="inline"><span class="i">$</span>{<span class="w">^Foo</span>}</code>
 denotes the scalar variable
whose name is considered to be a control-<code class="inline"><span class="w">F</span></code>
 followed by two <code class="inline"><span class="w">o</span></code>
's.
These variables are
reserved for future special uses by Perl, except for the ones that
begin with <code class="inline">^_</code> (caret-underscore).  No
name that begins with <code class="inline">^_</code> will acquire a special
meaning in any future version of Perl; such names may therefore be
used safely in programs.  <code class="inline"><span class="i">$^_</span></code>
 itself, however, <i>is</i> reserved.</p>
<p>Perl identifiers that begin with digits or
punctuation characters are exempt from the effects of the <code class="inline"><a class="l_k" href="functions/package.html">package</a></code>
declaration and are always forced to be in package <code class="inline"><span class="w">main</span></code>
; they are
also exempt from <code class="inline"><span class="w">strict</span> <span class="q">&#39;vars&#39;</span></code>
 errors.  A few other names are also
exempt in these ways:</p>
<pre class="verbatim"><ol><li>    <span class="w">ENV</span>      <span class="w">STDIN</span></li><li>    <span class="w">INC</span>      <span class="w">STDOUT</span></li><li>    <span class="w">ARGV</span>     <span class="w">STDERR</span></li><li>    <span class="w">ARGVOUT</span></li><li>    <span class="w">SIG</span></li></ol></pre><p>In particular, the special <code class="inline"><span class="i">$</span>{<span class="w">^_XYZ</span>}</code>
 variables are always taken
to be in package <code class="inline"><span class="w">main</span></code>
, regardless of any <code class="inline"><a class="l_k" href="functions/package.html">package</a></code> declarations
presently in scope.</p>
<a name="SPECIAL-VARIABLES"></a><h1>SPECIAL VARIABLES</h1>
<p>The following names have special meaning to Perl.  Most punctuation
names have reasonable mnemonics, or analogs in the shells.
Nevertheless, if you wish to use long variable names, you need only say:</p>
<pre class="verbatim"><ol><li>    <a class="l_k" href="functions/use.html">use</a> <span class="w">English</span><span class="sc">;</span></li></ol></pre><p>at the top of your program.  This aliases all the short names to the long
names in the current package.  Some even have medium names, generally
borrowed from <b>awk</b>.  For more info, please see <a href="English.html">English</a>.</p>
<p>Before you continue, note the sort order for variables.  In general, we
first list the variables in case-insensitive, almost-lexigraphical
order (ignoring the <code class="inline">{</code> or <code class="inline">^</code> preceding words, as in <code class="inline"><span class="i">$</span>{<span class="w">^UNICODE</span>}</code>

or <code class="inline"><span class="i">$^T</span></code>
), although <code class="inline"><span class="i">$_</span></code>
 and <code class="inline"><span class="i">@_</span></code>
 move up to the top of the pile.
For variables with the same identifier, we list it in order of scalar,
array, hash, and bareword.</p>
<a name="General-Variables"></a><h2>General Variables</h2>
<ul>
<li><a name="%24ARG"></a><b>$ARG</b>
</li>
<li><a name="%24_"></a><b>$_
 </b>
<p>The default input and pattern-searching space.  The following pairs are
equivalent:</p>
<pre class="verbatim"><ol><li>    <a class="l_k" href="functions/while.html">while</a> <span class="s">(</span>&lt;&gt;<span class="s">)</span> <span class="s">{</span>...<span class="s">}</span>    <span class="c"># equivalent only in while!</span></li><li>    <a class="l_k" href="functions/while.html">while</a> <span class="s">(</span><a class="l_k" href="functions/defined.html">defined</a><span class="s">(</span><span class="i">$_</span> = &lt;&gt;<span class="s">)</span><span class="s">)</span> <span class="s">{</span>...<span class="s">}</span></li><li></li><li>    <span class="q">/^Subject:/</span></li><li>    <span class="i">$_</span> =~ <span class="q">/^Subject:/</span></li><li></li><li>    <span class="q">tr/a-z/A-Z/</span></li><li>    <span class="i">$_</span> =~ <span class="q">tr/a-z/A-Z/</span></li><li></li><li>    <a class="l_k" href="functions/chomp.html">chomp</a></li><li>    <a class="l_k" href="functions/chomp.html">chomp</a><span class="s">(</span><span class="i">$_</span><span class="s">)</span></li></ol></pre><p>Here are the places where Perl will assume <code class="inline"><span class="i">$_</span></code>
 even if you don't use it:</p>
<ul>
<li>
<p>The following functions use <code class="inline"><span class="i">$_</span></code>
 as a default argument:</p>
<p>abs, alarm, chomp, chop, chr, chroot,
cos, defined, eval, evalbytes, exp, fc, glob, hex, int, lc,
lcfirst, length, log, lstat, mkdir, oct, ord, pos, print, printf,
quotemeta, readlink, readpipe, ref, require, reverse (in scalar context only),
rmdir, say, sin, split (for its second
argument), sqrt, stat, study, uc, ucfirst,
unlink, unpack.</p>
</li>
<li>
<p>All file tests (<code class="inline">-f</code>
, <code class="inline">-d</code>
) except for <code class="inline">-t</code>
, which defaults to STDIN.
See <a href="functions/-X.html">-X</a></p>
</li>
<li>
<p>The pattern matching operations <code class="inline"><a class="l_k" href="functions/m.html">m//</a></code>, <code class="inline"><a class="l_k" href="functions/s.html">s///</a></code> and <code class="inline"><a class="l_k" href="functions/tr.html">tr///</a></code> (aka <code class="inline"><a class="l_k" href="functions/y.html">y///</a></code>)
when used without an <code class="inline">=~</code>
 operator.</p>
</li>
<li>
<p>The default iterator variable in a <code class="inline">foreach</code>
 loop if no other
variable is supplied.</p>
</li>
<li>
<p>The implicit iterator variable in the <code class="inline"><a class="l_k" href="functions/grep.html">grep()</a></code> and <code class="inline"><a class="l_k" href="functions/map.html">map()</a></code> functions.</p>
</li>
<li>
<p>The implicit variable of <code class="inline">given<span class="s">(</span><span class="s">)</span></code>
.</p>
</li>
<li>
<p>The default place to put the next value or input record
when a <code class="inline"><span class="q">&lt;FH&gt;</span></code>
, <code class="inline"><a class="l_k" href="functions/readline.html">readline</a></code>, <code class="inline"><a class="l_k" href="functions/readdir.html">readdir</a></code> or <code class="inline"><a class="l_k" href="functions/each.html">each</a></code>
operation's result is tested by itself as the sole criterion of a <code class="inline">while</code>

test.  Outside a <code class="inline">while</code>
 test, this will not happen.</p>
</li>
</ul>
<p><code class="inline"><span class="i">$_</span></code>
 is by default a global variable.  However, as
of perl v5.10.0, you can use a lexical version of
<code class="inline"><span class="i">$_</span></code>
 by declaring it in a file or in a block with <code class="inline"><a class="l_k" href="functions/my.html">my</a></code>.  Moreover,
declaring <code class="inline"><a class="l_k" href="functions/our.html">our</a> <span class="i">$_</span></code>
 restores the global <code class="inline"><span class="i">$_</span></code>
 in the current scope.  Though
this seemed like a good idea at the time it was introduced, lexical <code class="inline"><span class="i">$_</span></code>

actually causes more problems than it solves.  If you call a function that
expects to be passed information via <code class="inline"><span class="i">$_</span></code>
, it may or may not work,
depending on how the function is written, there not being any easy way to
solve this.  Just avoid lexical <code class="inline"><span class="i">$_</span></code>
, unless you are feeling particularly
masochistic.  For this reason lexical <code class="inline"><span class="i">$_</span></code>
 is still experimental and will
produce a warning unless warnings have been disabled.  As with other
experimental features, the behavior of lexical <code class="inline"><span class="i">$_</span></code>
 is subject to change
without notice, including change into a fatal error.</p>
<p>Mnemonic: underline is understood in certain operations.</p>
</li>
<li><a name="%40ARG"></a><b>@ARG</b>
</li>
<li><a name="%40_"></a><b>@_
 </b>
<p>Within a subroutine the array <code class="inline"><span class="i">@_</span></code>
 contains the parameters passed to
that subroutine.  Inside a subroutine, <code class="inline"><span class="i">@_</span></code>
 is the default array for
the array operators <code class="inline"><a class="l_k" href="functions/pop.html">pop</a></code> and <code class="inline"><a class="l_k" href="functions/shift.html">shift</a></code>.</p>
<p>See <a href="perlsub.html">perlsub</a>.</p>
</li>
<li><a name="%24LIST_SEPARATOR"></a><b>$LIST_SEPARATOR</b>
</li>
<li><a name="%24%22"></a><b>$"
 </b>
<p>When an array or an array slice is interpolated into a double-quoted
string or a similar context such as <code class="inline"><span class="q">/.../</span></code>
, its elements are
separated by this value.  Default is a space.  For example, this:</p>
<pre class="verbatim"><ol><li>    <a class="l_k" href="functions/print.html">print</a> <span class="q">&quot;The array is: @array\n&quot;</span><span class="sc">;</span></li></ol></pre><p>is equivalent to this:</p>
<pre class="verbatim"><ol><li>    <a class="l_k" href="functions/print.html">print</a> <span class="q">&quot;The array is: &quot;</span> . <a class="l_k" href="functions/join.html">join</a><span class="s">(</span><span class="i">$&quot;</span><span class="cm">,</span> <span class="i">@array</span><span class="s">)</span> . <span class="q">&quot;\n&quot;</span><span class="sc">;</span></li></ol></pre><p>Mnemonic: works in double-quoted context.</p>
</li>
<li><a name="%24PROCESS_ID"></a><b>$PROCESS_ID</b>
</li>
<li><a name="%24PID"></a><b>$PID</b>
</li>
<li><a name="%24%24"></a><b>$$
  </b>
<p>The process number of the Perl running this script.  Though you <i>can</i> set
this variable, doing so is generally discouraged, although it can be
invaluable for some testing purposes.  It will be reset automatically
across <code class="inline"><a class="l_k" href="functions/fork.html">fork()</a></code> calls.</p>
<p>Note for Linux and Debian GNU/kFreeBSD users: Before Perl v5.16.0 perl
would emulate POSIX semantics on Linux systems using LinuxThreads, a
partial implementation of POSIX Threads that has since been superseded
by the Native POSIX Thread Library (NPTL).</p>
<p>LinuxThreads is now obsolete on Linux, and caching <code class="inline"><span class="i">getpid</span><span class="s">(</span><span class="s">)</span></code>

like this made embedding perl unnecessarily complex (since you'd have
to manually update the value of $$), so now <code class="inline"><span class="i">$$</span></code>
 and <code class="inline"><a class="l_k" href="functions/getppid.html">getppid()</a></code>
will always return the same values as the underlying C library.</p>
<p>Debian GNU/kFreeBSD systems also used LinuxThreads up until and
including the 6.0 release, but after that moved to FreeBSD thread
semantics, which are POSIX-like.</p>
<p>To see if your system is affected by this discrepancy check if
<code class="inline"><span class="w">getconf</span> <span class="w">GNU_LIBPTHREAD_VERSION</span> | <a class="l_k" href="functions/grep.html">grep</a> -<span class="q">q NPTL</span></code>
 returns a false
value.  NTPL threads preserve the POSIX semantics.</p>
<p>Mnemonic: same as shells.</p>
</li>
<li><a name="%24PROGRAM_NAME"></a><b>$PROGRAM_NAME</b>
</li>
<li><a name="%240"></a><b>$0
 </b>
<p>Contains the name of the program being executed.</p>
<p>On some (but not all) operating systems assigning to <code class="inline"><span class="i">$0</span></code>
 modifies
the argument area that the <code class="inline"><span class="w">ps</span></code>
 program sees.  On some platforms you
may have to use special <code class="inline"><span class="w">ps</span></code>
 options or a different <code class="inline"><span class="w">ps</span></code>
 to see the
changes.  Modifying the <code class="inline"><span class="i">$0</span></code>
 is more useful as a way of indicating the
current program state than it is for hiding the program you're
running.</p>
<p>Note that there are platform-specific limitations on the maximum
length of <code class="inline"><span class="i">$0</span></code>
.  In the most extreme case it may be limited to the
space occupied by the original <code class="inline"><span class="i">$0</span></code>
.</p>
<p>In some platforms there may be arbitrary amount of padding, for
example space characters, after the modified name as shown by <code class="inline"><span class="w">ps</span></code>
.
In some platforms this padding may extend all the way to the original
length of the argument area, no matter what you do (this is the case
for example with Linux 2.2).</p>
<p>Note for BSD users: setting <code class="inline"><span class="i">$0</span></code>
 does not completely remove "perl"
from the ps(1) output.  For example, setting <code class="inline"><span class="i">$0</span></code>
 to <code class="inline"><span class="q">&quot;foobar&quot;</span></code>
 may
result in <code class="inline"><span class="q">&quot;perl: foobar (perl)&quot;</span></code>
 (whether both the <code class="inline"><span class="q">&quot;perl: &quot;</span></code>
 prefix
and the " (perl)" suffix are shown depends on your exact BSD variant
and version).  This is an operating system feature, Perl cannot help it.</p>
<p>In multithreaded scripts Perl coordinates the threads so that any
thread may modify its copy of the <code class="inline"><span class="i">$0</span></code>
 and the change becomes visible
to ps(1) (assuming the operating system plays along).  Note that
the view of <code class="inline"><span class="i">$0</span></code>
 the other threads have will not change since they
have their own copies of it.</p>
<p>If the program has been given to perl via the switches <code class="inline">-e</code>
 or <code class="inline">-<span class="w">E</span></code>
,
<code class="inline"><span class="i">$0</span></code>
 will contain the string <code class="inline"><span class="q">&quot;-e&quot;</span></code>
.</p>
<p>On Linux as of perl v5.14.0 the legacy process name will be set with
<code class="inline"><span class="i">prctl</span><span class="s">(</span><span class="n">2</span><span class="s">)</span></code>
, in addition to altering the POSIX name via <code class="inline"><span class="w">argv</span><span class="s">[</span><span class="n">0</span><span class="s">]</span></code>
 as
perl has done since version 4.000.  Now system utilities that read the
legacy process name such as ps, top and killall will recognize the
name you set when assigning to <code class="inline"><span class="i">$0</span></code>
.  The string you supply will be
cut off at 16 bytes, this is a limitation imposed by Linux.</p>
<p>Mnemonic: same as <b>sh</b> and <b>ksh</b>.</p>
</li>
<li><a name="%24REAL_GROUP_ID"></a><b>$REAL_GROUP_ID</b>
</li>
<li><a name="%24GID"></a><b>$GID</b>
</li>
<li><a name="%24("></a><b>$(
  </b>
<p>The real gid of this process.  If you are on a machine that supports
membership in multiple groups simultaneously, gives a space separated
list of groups you are in.  The first number is the one returned by
<code class="inline"><span class="i">getgid</span><span class="s">(</span><span class="s">)</span></code>
, and the subsequent ones by <code class="inline"><span class="i">getgroups</span><span class="s">(</span><span class="s">)</span></code>
, one of which may be
the same as the first number.</p>
<p>However, a value assigned to <code class="inline"><span class="i">$(</span></code>
 must be a single number used to
set the real gid.  So the value given by <code class="inline"><span class="i">$(</span></code>
 should <i>not</i> be assigned
back to <code class="inline"><span class="i">$(</span></code>
 without being forced numeric, such as by adding zero.  Note
that this is different to the effective gid (<code class="inline"><span class="i">$)</span></code>
) which does take a
list.</p>
<p>You can change both the real gid and the effective gid at the same
time by using <code class="inline"><span class="i">POSIX::setgid</span><span class="s">(</span><span class="s">)</span></code>
.  Changes
to <code class="inline"><span class="i">$(</span></code>
 require a check to <code class="inline"><span class="i">$!</span></code>

to detect any possible errors after an attempted change.</p>
<p>Mnemonic: parentheses are used to <i>group</i> things.  The real gid is the
group you <i>left</i>, if you're running setgid.</p>
</li>
<li><a name="%24EFFECTIVE_GROUP_ID"></a><b>$EFFECTIVE_GROUP_ID</b>
</li>
<li><a name="%24EGID"></a><b>$EGID</b>
</li>
<li><a name="%24)"></a><b>$)
  </b>
<p>The effective gid of this process.  If you are on a machine that
supports membership in multiple groups simultaneously, gives a space
separated list of groups you are in.  The first number is the one
returned by <code class="inline"><span class="i">getegid</span><span class="s">(</span><span class="s">)</span></code>
, and the subsequent ones by <code class="inline"><span class="i">getgroups</span><span class="s">(</span><span class="s">)</span></code>
,
one of which may be the same as the first number.</p>
<p>Similarly, a value assigned to <code class="inline"><span class="i">$)</span></code>
 must also be a space-separated
list of numbers.  The first number sets the effective gid, and
the rest (if any) are passed to <code class="inline"><span class="i">setgroups</span><span class="s">(</span><span class="s">)</span></code>
.  To get the effect of an
empty list for <code class="inline"><span class="i">setgroups</span><span class="s">(</span><span class="s">)</span></code>
, just repeat the new effective gid; that is,
to force an effective gid of 5 and an effectively empty <code class="inline"><span class="i">setgroups</span><span class="s">(</span><span class="s">)</span></code>

list, say <code class="inline"> <span class="i">$)</span> = <span class="q">&quot;5 5&quot;</span> </code>
.</p>
<p>You can change both the effective gid and the real gid at the same
time by using <code class="inline"><span class="i">POSIX::setgid</span><span class="s">(</span><span class="s">)</span></code>
 (use only a single numeric argument).
Changes to <code class="inline"><span class="i">$)</span></code>
 require a check to <code class="inline"><span class="i">$!</span></code>
 to detect any possible errors
after an attempted change.</p>
<p><code class="inline"><span class="i">$&lt;</span></code>
, <code class="inline"><span class="i">$&gt;</span></code>
, <code class="inline"><span class="i">$(</span></code>
 and <code class="inline"><span class="i">$)</span></code>
 can be set only on
machines that support the corresponding <i>set[re][ug]id()</i> routine.  <code class="inline"><span class="i">$(</span></code>

and <code class="inline"><span class="i">$)</span></code>
 can be swapped only on machines supporting <code class="inline"><span class="i">setregid</span><span class="s">(</span><span class="s">)</span></code>
.</p>
<p>Mnemonic: parentheses are used to <i>group</i> things.  The effective gid
is the group that's <i>right</i> for you, if you're running setgid.</p>
</li>
<li><a name="%24REAL_USER_ID"></a><b>$REAL_USER_ID</b>
</li>
<li><a name="%24UID"></a><b>$UID</b>
</li>
<li><a name="%24%3c"></a><b>$&lt;
  </b>
<p>The real uid of this process.  You can change both the real uid and the
effective uid at the same time by using <code class="inline"><span class="i">POSIX::setuid</span><span class="s">(</span><span class="s">)</span></code>
.  Since
changes to <code class="inline"><span class="i">$&lt;</span></code>
 require a system call, check <code class="inline"><span class="i">$!</span></code>
 after a change
attempt to detect any possible errors.</p>
<p>Mnemonic: it's the uid you came <i>from</i>, if you're running setuid.</p>
</li>
<li><a name="%24EFFECTIVE_USER_ID"></a><b>$EFFECTIVE_USER_ID</b>
</li>
<li><a name="%24EUID"></a><b>$EUID</b>
</li>
<li><a name="%24%3e"></a><b>$&gt;
  </b>
<p>The effective uid of this process.  For example:</p>
<pre class="verbatim"><ol><li>    <span class="i">$&lt;</span> = <span class="i">$&gt;</span><span class="sc">;</span>            <span class="c"># set real to effective uid</span></li><li>    <span class="s">(</span><span class="i">$&lt;</span><span class="cm">,</span><span class="i">$&gt;</span><span class="s">)</span> = <span class="s">(</span><span class="i">$&gt;</span><span class="cm">,</span><span class="i">$&lt;</span><span class="s">)</span><span class="sc">;</span>  <span class="c"># swap real and effective uids</span></li></ol></pre><p>You can change both the effective uid and the real uid at the same
time by using <code class="inline"><span class="i">POSIX::setuid</span><span class="s">(</span><span class="s">)</span></code>
.  Changes to <code class="inline"><span class="i">$&gt;</span></code>
 require a check
to <code class="inline"><span class="i">$!</span></code>
 to detect any possible errors after an attempted change.</p>
<p><code class="inline"><span class="i">$&lt;</span></code>
 and <code class="inline"><span class="i">$&gt;</span></code>
 can be swapped only on machines
supporting <code class="inline"><span class="i">setreuid</span><span class="s">(</span><span class="s">)</span></code>
.</p>
<p>Mnemonic: it's the uid you went <i>to</i>, if you're running setuid.</p>
</li>
<li><a name="%24SUBSCRIPT_SEPARATOR"></a><b>$SUBSCRIPT_SEPARATOR</b>
</li>
<li><a name="%24SUBSEP"></a><b>$SUBSEP</b>
</li>
<li><a name="%24%3b"></a><b>$;
  </b>
<p>The subscript separator for multidimensional array emulation.  If you
refer to a hash element as</p>
<pre class="verbatim"><ol><li>    <span class="i">$foo</span>{<span class="i">$x</span><span class="cm">,</span><span class="i">$y</span><span class="cm">,</span><span class="i">$z</span>}</li></ol></pre><p>it really means</p>
<pre class="verbatim"><ol><li>    <span class="i">$foo</span>{<a class="l_k" href="functions/join.html">join</a><span class="s">(</span><span class="i">$;</span><span class="cm">,</span> <span class="i">$x</span><span class="cm">,</span> <span class="i">$y</span><span class="cm">,</span> <span class="i">$z</span><span class="s">)</span>}</li></ol></pre><p>But don't put</p>
<pre class="verbatim"><ol><li>    <span class="i">@foo</span>{<span class="i">$x</span><span class="cm">,</span><span class="i">$y</span><span class="cm">,</span><span class="i">$z</span>}	<span class="c"># a slice--note the @</span></li></ol></pre><p>which means</p>
<pre class="verbatim"><ol><li>    <span class="s">(</span><span class="i">$foo</span>{<span class="i">$x</span>}<span class="cm">,</span><span class="i">$foo</span>{<span class="i">$y</span>}<span class="cm">,</span><span class="i">$foo</span>{<span class="i">$z</span>}<span class="s">)</span></li></ol></pre><p>Default is "\034", the same as SUBSEP in <b>awk</b>.  If your keys contain
binary data there might not be any safe value for <code class="inline"><span class="i">$;</span></code>
.</p>
<p>Consider using "real" multidimensional arrays as described
in <a href="perllol.html">perllol</a>.</p>
<p>Mnemonic: comma (the syntactic subscript separator) is a semi-semicolon.</p>
</li>
<li><a name="%24a"></a><b>$a</b>
</li>
<li><a name="%24b"></a><b>$b
 </b>
<p>Special package variables when using <code class="inline"><a class="l_k" href="functions/sort.html">sort()</a></code>, see <a href="functions/sort.html">sort</a>.
Because of this specialness <code class="inline"><span class="i">$a</span></code>
 and <code class="inline"><span class="i">$b</span></code>
 don't need to be declared
(using <code class="inline"><a class="l_k" href="functions/use.html">use</a> <span class="w">vars</span></code>
, or <code class="inline"><a class="l_k" href="functions/our.html">our()</a></code>) even when using the <code class="inline"><span class="w">strict</span> <span class="q">&#39;vars&#39;</span></code>

pragma.  Don't lexicalize them with <code class="inline"><a class="l_k" href="functions/my.html">my</a> <span class="i">$a</span></code>
 or <code class="inline"><a class="l_k" href="functions/my.html">my</a> <span class="i">$b</span></code>
 if you want to
be able to use them in the <code class="inline"><a class="l_k" href="functions/sort.html">sort()</a></code> comparison block or function.</p>
</li>
<li><a name="%25ENV"></a><b>%ENV
</b>
<p>The hash <code class="inline"><span class="i">%ENV</span></code>
 contains your current environment.  Setting a
value in <code class="inline"><span class="w">ENV</span></code>
 changes the environment for any child processes
you subsequently <code class="inline"><a class="l_k" href="functions/fork.html">fork()</a></code> off.</p>
<p>As of v5.18.0, both keys and values stored in <code class="inline"><span class="i">%ENV</span></code>
 are stringified.</p>
<pre class="verbatim"><ol><li>    <a class="l_k" href="functions/my.html">my</a> <span class="i">$foo</span> = <span class="n">1</span><span class="sc">;</span></li><li>    <span class="i">$ENV</span>{<span class="q">&#39;bar&#39;</span>} = \<span class="i">$foo</span><span class="sc">;</span></li><li>    <a class="l_k" href="functions/if.html">if</a><span class="s">(</span> <a class="l_k" href="functions/ref.html">ref</a> <span class="i">$ENV</span>{<span class="q">&#39;bar&#39;</span>} <span class="s">)</span> <span class="s">{</span></li><li>        <a class="l_k" href="functions/say.html">say</a> <span class="q">&quot;Pre 5.18.0 Behaviour&quot;</span><span class="sc">;</span></li><li>    <span class="s">}</span> <a class="l_k" href="functions/else.html">else</a> <span class="s">{</span></li><li>        <a class="l_k" href="functions/say.html">say</a> <span class="q">&quot;Post 5.18.0 Behaviour&quot;</span><span class="sc">;</span></li><li>    <span class="s">}</span></li></ol></pre><p>Previously, only child processes received stringified values:</p>
<pre class="verbatim"><ol><li>    <a class="l_k" href="functions/my.html">my</a> <span class="i">$foo</span> = <span class="n">1</span><span class="sc">;</span></li><li>    <span class="i">$ENV</span>{<span class="q">&#39;bar&#39;</span>} = \<span class="i">$foo</span><span class="sc">;</span></li><li></li><li>    <span class="c"># Always printed &#39;non ref&#39;</span></li><li>    <a class="l_k" href="functions/system.html">system</a><span class="s">(</span><span class="i">$^X</span><span class="cm">,</span> <span class="q">&#39;-e&#39;</span><span class="cm">,</span></li><li>           <span class="q">q/print ( ref $ENV{&#39;bar&#39;}  ? &#39;ref&#39; : &#39;non ref&#39; ) /</span><span class="s">)</span><span class="sc">;</span></li></ol></pre><p>This happens because you can't really share arbitrary data structures with
foreign processes.</p>
</li>
<li><a name="%24OLD_PERL_VERSION"></a><b>$OLD_PERL_VERSION</b>
</li>
<li><a name="%24%5d"></a><b>$]
 </b>
<p>The revision, version, and subversion of the Perl interpreter, represented
as a decimal of the form 5.XXXYYY, where XXX is the version / 1e3 and YYY
is the subversion / 1e6.  For example, Perl v5.10.1 would be "5.010001".</p>
<p>This variable can be used to determine whether the Perl interpreter
executing a script is in the right range of versions:</p>
<pre class="verbatim"><ol><li>    <a class="l_k" href="functions/warn.html">warn</a> <span class="q">&quot;No PerlIO!\n&quot;</span> <a class="l_k" href="functions/if.html">if</a> <span class="i">$]</span> <a class="l_k" href="functions/lt.html">lt</a> <span class="q">&#39;5.008&#39;</span><span class="sc">;</span></li></ol></pre><p>When comparing <code class="inline"><span class="i">$]</span></code>
, string comparison operators are <b>highly
recommended</b>.  The inherent limitations of binary floating point
representation can sometimes lead to incorrect comparisons for some
numbers on some architectures.</p>
<p>See also the documentation of <code class="inline"><a class="l_k" href="functions/use.html">use</a> <span class="w">VERSION</span></code>
 and <code class="inline"><a class="l_k" href="functions/require.html">require</a> <span class="w">VERSION</span></code>

for a convenient way to fail if the running Perl interpreter is too old.</p>
<p>See <a href="#%24%5eV">$^V</a> for a representation of the Perl version as a <a href="version.html">version</a>
object, which allows more flexible string comparisons.</p>
<p>The main advantage of <code class="inline"><span class="i">$]</span></code>
 over <code class="inline"><span class="i">$^V</span></code>
 is that it works the same on any
version of Perl.  The disadvantages are that it can't easily be compared
to versions in other formats (e.g. literal v-strings, "v1.2.3" or
version objects) and numeric comparisons can occasionally fail; it's good
for string literal version checks and bad for comparing to a variable
that hasn't been sanity-checked.</p>
<p>The <code class="inline"><span class="i">$OLD_PERL_VERSION</span></code>
 form was added in Perl v5.20.0 for historical
reasons but its use is discouraged. (If your reason to use <code class="inline"><span class="i">$]</span></code>
 is to
run code on old perls then referring to it as <code class="inline"><span class="i">$OLD_PERL_VERSION</span></code>
 would
be self-defeating.)</p>
<p>Mnemonic: Is this version of perl in the right bracket?</p>
</li>
<li><a name="%24SYSTEM_FD_MAX"></a><b>$SYSTEM_FD_MAX</b>
</li>
<li><a name="%24%5eF"></a><b>$^F
 </b>
<p>The maximum system file descriptor, ordinarily 2.  System file
descriptors are passed to <code class="inline"><a class="l_k" href="functions/exec.html">exec()</a></code>ed processes, while higher file
descriptors are not.  Also, during an
<code class="inline"><a class="l_k" href="functions/open.html">open()</a></code>, system file descriptors are
preserved even if the <code class="inline"><a class="l_k" href="functions/open.html">open()</a></code> fails (ordinary file descriptors are
closed before the <code class="inline"><a class="l_k" href="functions/open.html">open()</a></code> is attempted).  The close-on-exec
status of a file descriptor will be decided according to the value of
<code class="inline"><span class="i">$^F</span></code>
 when the corresponding file, pipe, or socket was opened, not the
time of the <code class="inline"><a class="l_k" href="functions/exec.html">exec()</a></code>.</p>
</li>
<li><a name="%40F"></a><b>@F
</b>
<p>The array <code class="inline"><span class="i">@F</span></code>
 contains the fields of each line read in when autosplit
mode is turned on.  See <a href="perlrun.html">perlrun</a> for the <b>-a</b> switch.  This array
is package-specific, and must be declared or given a full package name
if not in package main when running under <code class="inline"><span class="w">strict</span> <span class="q">&#39;vars&#39;</span></code>
.</p>
</li>
<li><a name="%40INC"></a><b>@INC
</b>
<p>The array <code class="inline"><span class="i">@INC</span></code>
 contains the list of places that the <code class="inline"><a class="l_k" href="functions/do.html">do</a> <span class="w">EXPR</span></code>
,
<code class="inline"><a class="l_k" href="functions/require.html">require</a></code>, or <code class="inline"><a class="l_k" href="functions/use.html">use</a></code> constructs look for their library files.  It
initially consists of the arguments to any <b>-I</b> command-line
switches, followed by the default Perl library, probably
<i>/usr/local/lib/perl</i>, followed by ".", to represent the current
directory.  ("." will not be appended if taint checks are enabled,
either by <code class="inline">-T</code>
 or by <code class="inline">-t</code>
, or if configured not to do so by the
<code class="inline">-<span class="w">Ddefault_inc_excludes_dot</span></code>
 compile time option.)  If you need to
modify this at runtime, you should use the <code class="inline"><a class="l_k" href="functions/use.html">use</a> <span class="w">lib</span></code>
 pragma to get
the machine-dependent library properly loaded also:</p>
<pre class="verbatim"><ol><li>    <a class="l_k" href="functions/use.html">use</a> <span class="w">lib</span> <span class="q">&#39;/mypath/libdir/&#39;</span><span class="sc">;</span></li><li>    <a class="l_k" href="functions/use.html">use</a> <span class="w">SomeMod</span><span class="sc">;</span></li></ol></pre><p>You can also insert hooks into the file inclusion system by putting Perl
code directly into <code class="inline"><span class="i">@INC</span></code>
.  Those hooks may be subroutine references,
array references or blessed objects.  See <a href="functions/require.html">require</a> for details.</p>
</li>
<li><a name="%25INC"></a><b>%INC
</b>
<p>The hash <code class="inline"><span class="i">%INC</span></code>
 contains entries for each filename included via the
<code class="inline"><a class="l_k" href="functions/do.html">do</a></code>, <code class="inline"><a class="l_k" href="functions/require.html">require</a></code>, or <code class="inline"><a class="l_k" href="functions/use.html">use</a></code> operators.  The key is the filename
you specified (with module names converted to pathnames), and the
value is the location of the file found.  The <code class="inline"><a class="l_k" href="functions/require.html">require</a></code>
operator uses this hash to determine whether a particular file has
already been included.</p>
<p>If the file was loaded via a hook (e.g. a subroutine reference, see
<a href="functions/require.html">require</a> for a description of these hooks), this hook is
by default inserted into <code class="inline"><span class="i">%INC</span></code>
 in place of a filename.  Note, however,
that the hook may have set the <code class="inline"><span class="i">%INC</span></code>
 entry by itself to provide some more
specific info.</p>
</li>
<li><a name="%24INPLACE_EDIT"></a><b>$INPLACE_EDIT</b>
</li>
<li><a name="%24%5eI"></a><b>$^I
 </b>
<p>The current value of the inplace-edit extension.  Use <code class="inline"><a class="l_k" href="functions/undef.html">undef</a></code> to disable
inplace editing.</p>
<p>Mnemonic: value of <b>-i</b> switch.</p>
</li>
<li><a name="%40ISA"></a><b>@ISA
</b>
<p>Each package contains a special array called <code class="inline"><span class="i">@ISA</span></code>
 which contains a list
of that class's parent classes, if any. This array is simply a list of
scalars, each of which is a string that corresponds to a package name. The
array is examined when Perl does method resolution, which is covered in
<a href="perlobj.html">perlobj</a>.</p>
<p>To load packages while adding them to <code class="inline"><span class="i">@ISA</span></code>
, see the <a href="parent.html">parent</a> pragma. The
discouraged <a href="base.html">base</a> pragma does this as well, but should not be used except
when compatibility with the discouraged <a href="fields.html">fields</a> pragma is required.</p>
</li>
<li><a name="%24%5eM"></a><b>$^M
</b>
<p>By default, running out of memory is an untrappable, fatal error.
However, if suitably built, Perl can use the contents of <code class="inline"><span class="i">$^M</span></code>

as an emergency memory pool after <code class="inline"><a class="l_k" href="functions/die.html">die()</a></code>ing.  Suppose that your Perl
were compiled with <code class="inline">-<span class="w">DPERL_EMERGENCY_SBRK</span></code>
 and used Perl's malloc.
Then</p>
<pre class="verbatim"><ol><li>    <span class="i">$^M</span> = <span class="q">&#39;a&#39;</span> x <span class="s">(</span><span class="n">1</span> &lt;&lt; <span class="n">16</span><span class="s">)</span><span class="sc">;</span></li></ol></pre><p>would allocate a 64K buffer for use in an emergency.  See the
<i>INSTALL</i> file in the Perl distribution for information on how to
add custom C compilation flags when compiling perl.  To discourage casual
use of this advanced feature, there is no <a href="English.html">English</a> long name for
this variable.</p>
<p>This variable was added in Perl 5.004.</p>
</li>
<li><a name="%24OSNAME"></a><b>$OSNAME</b>
</li>
<li><a name="%24%5eO"></a><b>$^O
 </b>
<p>The name of the operating system under which this copy of Perl was
built, as determined during the configuration process.  For examples
see <a href="perlport.html#PLATFORMS">PLATFORMS in perlport</a>.</p>
<p>The value is identical to <code class="inline"><span class="i">$Config</span>{<span class="q">&#39;osname&#39;</span>}</code>
.  See also <a href="Config.html">Config</a>
and the <b>-V</b> command-line switch documented in <a href="perlrun.html">perlrun</a>.</p>
<p>In Windows platforms, <code class="inline"><span class="i">$^O</span></code>
 is not very helpful: since it is always
<code class="inline"><span class="w">MSWin32</span></code>
, it doesn't tell the difference between
95/98/ME/NT/2000/XP/CE/.NET.  Use <code class="inline"><span class="i">Win32::GetOSName</span><span class="s">(</span><span class="s">)</span></code>
 or
Win32::GetOSVersion() (see <a href="http://search.cpan.org/perldoc/Win32">Win32</a> and <a href="perlport.html">perlport</a>) to distinguish
between the variants.</p>
<p>This variable was added in Perl 5.003.</p>
</li>
<li><a name="%25SIG"></a><b>%SIG
</b>
<p>The hash <code class="inline"><span class="i">%SIG</span></code>
 contains signal handlers for signals.  For example:</p>
<pre class="verbatim"><ol><li><a name="handler"></a>    sub <span class="m">handler</span> <span class="s">{</span>   <span class="c"># 1st argument is signal name</span></li><li>	<a class="l_k" href="functions/my.html">my</a><span class="s">(</span><span class="i">$sig</span><span class="s">)</span> = <span class="i">@_</span><span class="sc">;</span></li><li>	<a class="l_k" href="functions/print.html">print</a> <span class="q">&quot;Caught a SIG$sig--shutting down\n&quot;</span><span class="sc">;</span></li><li>	<a class="l_k" href="functions/close.html">close</a><span class="s">(</span><span class="w">LOG</span><span class="s">)</span><span class="sc">;</span></li><li>	<a class="l_k" href="functions/exit.html">exit</a><span class="s">(</span><span class="n">0</span><span class="s">)</span><span class="sc">;</span></li><li>	<span class="s">}</span></li><li></li><li>    <span class="i">$SIG</span>{<span class="q">&#39;INT&#39;</span>}  = \<span class="i">&amp;handler</span><span class="sc">;</span></li><li>    <span class="i">$SIG</span>{<span class="q">&#39;QUIT&#39;</span>} = \<span class="i">&amp;handler</span><span class="sc">;</span></li><li>    ...</li><li>    <span class="i">$SIG</span>{<span class="q">&#39;INT&#39;</span>}  = <span class="q">&#39;DEFAULT&#39;</span><span class="sc">;</span>   <span class="c"># restore default action</span></li><li>    <span class="i">$SIG</span>{<span class="q">&#39;QUIT&#39;</span>} = <span class="q">&#39;IGNORE&#39;</span><span class="sc">;</span>    <span class="c"># ignore SIGQUIT</span></li></ol></pre><p>Using a value of <code class="inline"><span class="q">&#39;IGNORE&#39;</span></code>
 usually has the effect of ignoring the
signal, except for the <code class="inline"><span class="w">CHLD</span></code>
 signal.  See <a href="perlipc.html">perlipc</a> for more about
this special case.</p>
<p>Here are some other examples:</p>
<pre class="verbatim"><ol><li>    <span class="i">$SIG</span>{<span class="q">&quot;PIPE&quot;</span>} = <span class="q">&quot;Plumber&quot;</span><span class="sc">;</span>   <span class="c"># assumes main::Plumber (not</span></li><li>				<span class="c"># recommended)</span></li><li>    <span class="i">$SIG</span>{<span class="q">&quot;PIPE&quot;</span>} = \<span class="i">&amp;Plumber</span><span class="sc">;</span>   <span class="c"># just fine; assume current</span></li><li>				<span class="c"># Plumber</span></li><li>    <span class="i">$SIG</span>{<span class="q">&quot;PIPE&quot;</span>} = <span class="i">*Plumber</span><span class="sc">;</span>    <span class="c"># somewhat esoteric</span></li><li>    <span class="i">$SIG</span>{<span class="q">&quot;PIPE&quot;</span>} = <span class="i">Plumber</span><span class="s">(</span><span class="s">)</span><span class="sc">;</span>   <span class="c"># oops, what did Plumber()</span></li><li>				<span class="c"># return??</span></li></ol></pre><p>Be sure not to use a bareword as the name of a signal handler,
lest you inadvertently call it.</p>
<p>If your system has the <code class="inline"><span class="i">sigaction</span><span class="s">(</span><span class="s">)</span></code>
 function then signal handlers
are installed using it.  This means you get reliable signal handling.</p>
<p>The default delivery policy of signals changed in Perl v5.8.0 from
immediate (also known as "unsafe") to deferred, also known as "safe
signals".  See <a href="perlipc.html">perlipc</a> for more information.</p>
<p>Certain internal hooks can be also set using the <code class="inline"><span class="i">%SIG</span></code>
 hash.  The
routine indicated by <code class="inline"><span class="i">$SIG</span>{<span class="w">__WARN__</span>}</code>
 is called when a warning
message is about to be printed.  The warning message is passed as the
first argument.  The presence of a <code class="inline"><span class="w">__WARN__</span></code>
 hook causes the
ordinary printing of warnings to <code class="inline"><span class="w">STDERR</span></code>
 to be suppressed.  You can
use this to save warnings in a variable, or turn warnings into fatal
errors, like this:</p>
<pre class="verbatim"><ol><li>    <a class="l_k" href="functions/local.html">local</a> <span class="i">$SIG</span>{<span class="w">__WARN__</span>} = <a class="l_k" href="functions/sub.html">sub</a> <span class="s">{</span> <a class="l_k" href="functions/die.html">die</a> <span class="i">$_</span>[<span class="n">0</span>] <span class="s">}</span><span class="sc">;</span></li><li>    <a class="l_k" href="functions/eval.html">eval</a> <span class="i">$proggie</span><span class="sc">;</span></li></ol></pre><p>As the <code class="inline"><span class="q">&#39;IGNORE&#39;</span></code>
 hook is not supported by <code class="inline"><span class="w">__WARN__</span></code>
, you can
disable warnings using the empty subroutine:</p>
<pre class="verbatim"><ol><li>    <a class="l_k" href="functions/local.html">local</a> <span class="i">$SIG</span>{<span class="w">__WARN__</span>} = <a class="l_k" href="functions/sub.html">sub</a> <span class="s">{</span><span class="s">}</span><span class="sc">;</span></li></ol></pre><p>The routine indicated by <code class="inline"><span class="i">$SIG</span>{<span class="w">__DIE__</span>}</code>
 is called when a fatal
exception is about to be thrown.  The error message is passed as the
first argument.  When a <code class="inline"><span class="w">__DIE__</span></code>
 hook routine returns, the exception
processing continues as it would have in the absence of the hook,
unless the hook routine itself exits via a <code class="inline"><a class="l_k" href="functions/goto.html">goto</a> <span class="i">&amp;sub</span></code>
, a loop exit,
or a <code class="inline"><a class="l_k" href="functions/die.html">die()</a></code>.  The <code class="inline"><span class="w">__DIE__</span></code>
 handler is explicitly disabled during
the call, so that you can die from a <code class="inline"><span class="w">__DIE__</span></code>
 handler.  Similarly
for <code class="inline"><span class="w">__WARN__</span></code>
.</p>
<p>The <code class="inline"><span class="i">$SIG</span>{<span class="w">__DIE__</span>}</code>
 hook is called even inside an <code class="inline"><a class="l_k" href="functions/eval.html">eval()</a></code>. It was
never intended to happen this way, but an implementation glitch made
this possible. This used to be deprecated, as it allowed strange action
at a distance like rewriting a pending exception in <code class="inline"><span class="i">$@</span></code>
. Plans to
rectify this have been scrapped, as users found that rewriting a 
pending exception is actually a useful feature, and not a bug.</p>
<p><code class="inline"><span class="w">__DIE__</span></code>
/<code class="inline"><span class="w">__WARN__</span></code>
 handlers are very special in one respect: they
may be called to report (probable) errors found by the parser.  In such
a case the parser may be in inconsistent state, so any attempt to
evaluate Perl code from such a handler will probably result in a
segfault.  This means that warnings or errors that result from parsing
Perl should be used with extreme caution, like this:</p>
<pre class="verbatim"><ol><li>    <a class="l_k" href="functions/require.html">require</a> <span class="w">Carp</span> <a class="l_k" href="functions/if.html">if</a> <a class="l_k" href="functions/defined.html">defined</a> <span class="i">$^S</span><span class="sc">;</span></li><li>    <span class="i">Carp::confess</span><span class="s">(</span><span class="q">&quot;Something wrong&quot;</span><span class="s">)</span> <a class="l_k" href="functions/if.html">if</a> <a class="l_k" href="functions/defined.html">defined</a> <span class="i">&amp;Carp::confess</span><span class="sc">;</span></li><li>    <a class="l_k" href="functions/die.html">die</a> <span class="q">&quot;Something wrong, but could not load Carp to give &quot;</span></li><li>      . <span class="q">&quot;backtrace...\n\t&quot;</span></li><li>      . <span class="q">&quot;To see backtrace try starting Perl with -MCarp switch&quot;</span><span class="sc">;</span></li></ol></pre><p>Here the first line will load <code class="inline"><span class="w">Carp</span></code>
 <i>unless</i> it is the parser who
called the handler.  The second line will print backtrace and die if
<code class="inline"><span class="w">Carp</span></code>
 was available.  The third line will be executed only if <code class="inline"><span class="w">Carp</span></code>
 was
not available.</p>
<p>Having to even think about the <code class="inline"><span class="i">$^S</span></code>
 variable in your exception
handlers is simply wrong.  <code class="inline"><span class="i">$SIG</span>{<span class="w">__DIE__</span>}</code>
 as currently implemented
invites grievous and difficult to track down errors.  Avoid it
and use an <code class="inline">END<span class="s">{</span><span class="s">}</span></code>
 or CORE::GLOBAL::die override instead.</p>
<p>See <a href="functions/die.html">die</a>, <a href="functions/warn.html">warn</a>, <a href="functions/eval.html">eval</a>, and
<a href="warnings.html">warnings</a> for additional information.</p>
</li>
<li><a name="%24BASETIME"></a><b>$BASETIME</b>
</li>
<li><a name="%24%5eT"></a><b>$^T
 </b>
<p>The time at which the program began running, in seconds since the
epoch (beginning of 1970).  The values returned by the <b>-M</b>, <b>-A</b>,
and <b>-C</b> filetests are based on this value.</p>
</li>
<li><a name="%24PERL_VERSION"></a><b>$PERL_VERSION</b>
</li>
<li><a name="%24%5eV"></a><b>$^V
 </b>
<p>The revision, version, and subversion of the Perl interpreter,
represented as a <a href="version.html">version</a> object.</p>
<p>This variable first appeared in perl v5.6.0; earlier versions of perl
will see an undefined value.  Before perl v5.10.0 <code class="inline"><span class="i">$^V</span></code>
 was represented
as a v-string rather than a <a href="version.html">version</a> object.</p>
<p><code class="inline"><span class="i">$^V</span></code>
 can be used to determine whether the Perl interpreter executing
a script is in the right range of versions.  For example:</p>
<pre class="verbatim"><ol><li>    <a class="l_k" href="functions/warn.html">warn</a> <span class="q">&quot;Hashes not randomized!\n&quot;</span> if !<span class="i">$^V</span> or <span class="i">$^V</span> lt <span class="v">v5.8.1</span></li></ol></pre><p>While version objects overload stringification, to portably convert
<code class="inline"><span class="i">$^V</span></code>
 into its string representation, use <code class="inline"><a class="l_k" href="functions/sprintf.html">sprintf()</a></code>'s <code class="inline"><span class="q">&quot;%vd&quot;</span></code>

conversion, which works for both v-strings or version objects:</p>
<pre class="verbatim"><ol><li>    <a class="l_k" href="functions/printf.html">printf</a> <span class="q">&quot;version is v%vd\n&quot;</span><span class="cm">,</span> <span class="i">$^V</span><span class="sc">;</span>  <span class="c"># Perl&#39;s version</span></li></ol></pre><p>See the documentation of <code class="inline"><a class="l_k" href="functions/use.html">use</a> <span class="w">VERSION</span></code>
 and <code class="inline"><a class="l_k" href="functions/require.html">require</a> <span class="w">VERSION</span></code>

for a convenient way to fail if the running Perl interpreter is too old.</p>
<p>See also <code class="inline"><a href="#%24%5d">$]</a></code> for a decimal representation of the Perl version.</p>
<p>The main advantage of <code class="inline"><span class="i">$^V</span></code>
 over <code class="inline"><span class="i">$]</span></code>
 is that, for Perl v5.10.0 or
later, it overloads operators, allowing easy comparison against other
version representations (e.g. decimal, literal v-string, "v1.2.3", or
objects).  The disadvantage is that prior to v5.10.0, it was only a
literal v-string, which can't be easily printed or compared, whereas
the behavior of <code class="inline"><span class="i">$]</span></code>
 is unchanged on all versions of Perl.</p>
<p>Mnemonic: use ^V for a version object.</p>
</li>
<li><a name="%24%7b%5eWIN32_SLOPPY_STAT%7d"></a><b>${^WIN32_SLOPPY_STAT}
  </b>
<p>If this variable is set to a true value, then <code class="inline"><a class="l_k" href="functions/stat.html">stat()</a></code> on Windows will
not try to open the file.  This means that the link count cannot be
determined and file attributes may be out of date if additional
hardlinks to the file exist.  On the other hand, not opening the file
is considerably faster, especially for files on network drives.</p>
<p>This variable could be set in the <i>sitecustomize.pl</i> file to
configure the local Perl installation to use "sloppy" <code class="inline"><a class="l_k" href="functions/stat.html">stat()</a></code> by
default.  See the documentation for <b>-f</b> in
<a href="perlrun.html#Command-Switches">perlrun</a> for more information about site
customization.</p>
<p>This variable was added in Perl v5.10.0.</p>
</li>
<li><a name="%24EXECUTABLE_NAME"></a><b>$EXECUTABLE_NAME</b>
</li>
<li><a name="%24%5eX"></a><b>$^X
 </b>
<p>The name used to execute the current copy of Perl, from C's
<code class="inline"><span class="w">argv</span><span class="s">[</span><span class="n">0</span><span class="s">]</span></code>
 or (where supported) <i>/proc/self/exe</i>.</p>
<p>Depending on the host operating system, the value of <code class="inline"><span class="i">$^X</span></code>
 may be
a relative or absolute pathname of the perl program file, or may
be the string used to invoke perl but not the pathname of the
perl program file.  Also, most operating systems permit invoking
programs that are not in the PATH environment variable, so there
is no guarantee that the value of <code class="inline"><span class="i">$^X</span></code>
 is in PATH.  For VMS, the
value may or may not include a version number.</p>
<p>You usually can use the value of <code class="inline"><span class="i">$^X</span></code>
 to re-invoke an independent
copy of the same perl that is currently running, e.g.,</p>
<pre class="verbatim"><ol><li>    <span class="i">@first_run</span> = <span class="q">`$^X -le &quot;print int rand 100 for 1..100&quot;`</span><span class="sc">;</span></li></ol></pre><p>But recall that not all operating systems support forking or
capturing of the output of commands, so this complex statement
may not be portable.</p>
<p>It is not safe to use the value of <code class="inline"><span class="i">$^X</span></code>
 as a path name of a file,
as some operating systems that have a mandatory suffix on
executable files do not require use of the suffix when invoking
a command.  To convert the value of <code class="inline"><span class="i">$^X</span></code>
 to a path name, use the
following statements:</p>
<pre class="verbatim"><ol><li>    <span class="c"># Build up a set of file names (not command names).</span></li><li>    <a class="l_k" href="functions/use.html">use</a> <span class="w">Config</span><span class="sc">;</span></li><li>    <a class="l_k" href="functions/my.html">my</a> <span class="i">$this_perl</span> = <span class="i">$^X</span><span class="sc">;</span></li><li>    <a class="l_k" href="functions/if.html">if</a> <span class="s">(</span><span class="i">$^O</span> <a class="l_k" href="functions/ne.html">ne</a> <span class="q">&#39;VMS&#39;</span><span class="s">)</span> <span class="s">{</span></li><li>	<span class="i">$this_perl</span> .= <span class="i">$Config</span>{<span class="w">_exe</span>}</li><li>	  <a class="l_k" href="functions/unless.html">unless</a> <span class="i">$this_perl</span> =~ <span class="q">m/$Config{_exe}$/i</span><span class="sc">;</span></li><li>	<span class="s">}</span></li></ol></pre><p>Because many operating systems permit anyone with read access to
the Perl program file to make a copy of it, patch the copy, and
then execute the copy, the security-conscious Perl programmer
should take care to invoke the installed copy of perl, not the
copy referenced by <code class="inline"><span class="i">$^X</span></code>
.  The following statements accomplish
this goal, and produce a pathname that can be invoked as a
command or referenced as a file.</p>
<pre class="verbatim"><ol><li>    <a class="l_k" href="functions/use.html">use</a> <span class="w">Config</span><span class="sc">;</span></li><li>    <a class="l_k" href="functions/my.html">my</a> <span class="i">$secure_perl_path</span> = <span class="i">$Config</span>{<span class="w">perlpath</span>}<span class="sc">;</span></li><li>    <a class="l_k" href="functions/if.html">if</a> <span class="s">(</span><span class="i">$^O</span> <a class="l_k" href="functions/ne.html">ne</a> <span class="q">&#39;VMS&#39;</span><span class="s">)</span> <span class="s">{</span></li><li>	<span class="i">$secure_perl_path</span> .= <span class="i">$Config</span>{<span class="w">_exe</span>}</li><li>	    <a class="l_k" href="functions/unless.html">unless</a> <span class="i">$secure_perl_path</span> =~ <span class="q">m/$Config{_exe}$/i</span><span class="sc">;</span></li><li>	<span class="s">}</span></li></ol></pre></li>
</ul>
<a name="Variables-related-to-regular-expressions"></a><h2>Variables related to regular expressions</h2>
<p>Most of the special variables related to regular expressions are side
effects.  Perl sets these variables when it has a successful match, so
you should check the match result before using them.  For instance:</p>
<pre class="verbatim"><ol><li>    <a class="l_k" href="functions/if.html">if</a><span class="s">(</span> <span class="q">/P(A)TT(ER)N/</span> <span class="s">)</span> <span class="s">{</span></li><li>	<a class="l_k" href="functions/print.html">print</a> <span class="q">&quot;I found $1 and $2\n&quot;</span><span class="sc">;</span></li><li>	<span class="s">}</span></li></ol></pre><p>These variables are read-only and dynamically-scoped, unless we note
otherwise.</p>
<p>The dynamic nature of the regular expression variables means that
their value is limited to the block that they are in, as demonstrated
by this bit of code:</p>
<pre class="verbatim"><ol><li>    <a class="l_k" href="functions/my.html">my</a> <span class="i">$outer</span> = <span class="q">&#39;Wallace and Grommit&#39;</span><span class="sc">;</span></li><li>    <a class="l_k" href="functions/my.html">my</a> <span class="i">$inner</span> = <span class="q">&#39;Mutt and Jeff&#39;</span><span class="sc">;</span></li><li></li><li>    <a class="l_k" href="functions/my.html">my</a> <span class="i">$pattern</span> = <span class="q">qr/(\S+) and (\S+)/</span><span class="sc">;</span></li><li></li><li><a name="show_n"></a>    sub <span class="m">show_n</span> <span class="s">{</span> <a class="l_k" href="functions/print.html">print</a> <span class="q">&quot;\$1 is $1; \$2 is $2\n&quot;</span> <span class="s">}</span></li><li></li><li>    <span class="s">{</span></li><li>    <span class="j">OUTER:</span></li><li>	<span class="i">show_n</span><span class="s">(</span><span class="s">)</span> <a class="l_k" href="functions/if.html">if</a> <span class="i">$outer</span> =~ <span class="q">m/$pattern/</span><span class="sc">;</span></li><li></li><li>	<span class="j">INNER:</span> <span class="s">{</span></li><li>	    <span class="i">show_n</span><span class="s">(</span><span class="s">)</span> <a class="l_k" href="functions/if.html">if</a> <span class="i">$inner</span> =~ <span class="q">m/$pattern/</span><span class="sc">;</span></li><li>	    <span class="s">}</span></li><li></li><li>	<span class="i">show_n</span><span class="s">(</span><span class="s">)</span><span class="sc">;</span></li><li>    <span class="s">}</span></li></ol></pre><p>The output shows that while in the <code class="inline"><span class="w">OUTER</span></code>
 block, the values of <code class="inline"><span class="i">$1</span></code>

and <code class="inline"><span class="i">$2</span></code>
 are from the match against <code class="inline"><span class="i">$outer</span></code>
.  Inside the <code class="inline"><span class="w">INNER</span></code>

block, the values of <code class="inline"><span class="i">$1</span></code>
 and <code class="inline"><span class="i">$2</span></code>
 are from the match against
<code class="inline"><span class="i">$inner</span></code>
, but only until the end of the block (i.e. the dynamic
scope).  After the <code class="inline"><span class="w">INNER</span></code>
 block completes, the values of <code class="inline"><span class="i">$1</span></code>
 and
<code class="inline"><span class="i">$2</span></code>
 return to the values for the match against <code class="inline"><span class="i">$outer</span></code>
 even though
we have not made another match:</p>
<pre class="verbatim"><ol><li>    <span class="i">$1</span> <span class="w">is</span> <span class="w">Wallace</span><span class="sc">;</span> <span class="i">$2</span> <span class="w">is</span> <span class="w">Grommit</span></li><li>    <span class="i">$1</span> <span class="w">is</span> <span class="w">Mutt</span><span class="sc">;</span> <span class="i">$2</span> <span class="w">is</span> <span class="w">Jeff</span></li><li>    <span class="i">$1</span> <span class="w">is</span> <span class="w">Wallace</span><span class="sc">;</span> <span class="i">$2</span> <span class="w">is</span> <span class="w">Grommit</span></li></ol></pre><a name="Performance-issues"></a><h3>Performance issues</h3>
<p>Traditionally in Perl, any use of any of the three variables  <code class="inline"><span class="i">$`</span></code>
, <code class="inline"><span class="i">$&amp;</span></code>

or <code class="inline"><span class="i">$&#39;</span></code>
 (or their <code class="inline"><a class="l_k" href="functions/use.html">use</a> <span class="w">English</span></code>
 equivalents) anywhere in the code, caused
all subsequent successful pattern matches to make a copy of the matched
string, in case the code might subsequently access one of those variables.
This imposed a considerable performance penalty across the whole program,
so generally the use of these variables has been discouraged.</p>
<p>In Perl 5.6.0 the <code class="inline"><span class="i">@-</span></code>
 and <code class="inline"><span class="i">@+</span></code>
 dynamic arrays were introduced that
supply the indices of successful matches. So you could for example do
this:</p>
<pre class="verbatim"><ol><li>    <span class="i">$str</span> =~ <span class="q">/pattern/</span><span class="sc">;</span></li><li></li><li>    <a class="l_k" href="functions/print.html">print</a> <span class="i">$`</span><span class="cm">,</span> <span class="i">$&amp;</span><span class="cm">,</span> <span class="i">$&#39;</span><span class="sc">;</span> <span class="c"># bad: perfomance hit</span></li><li></li><li>    <a class="l_k" href="functions/print.html">print</a>             <span class="c"># good: no perfomance hit</span></li><li>	<a class="l_k" href="functions/substr.html">substr</a><span class="s">(</span><span class="i">$str</span><span class="cm">,</span> <span class="n">0</span><span class="cm">,</span>     <span class="i">$-</span>[<span class="n">0</span>]<span class="s">)</span><span class="cm">,</span></li><li>	<a class="l_k" href="functions/substr.html">substr</a><span class="s">(</span><span class="i">$str</span><span class="cm">,</span> <span class="i">$-</span>[<span class="n">0</span>]<span class="cm">,</span> <span class="i">$+</span>[<span class="n">0</span>]-<span class="i">$-</span>[<span class="n">0</span>]<span class="s">)</span><span class="cm">,</span></li><li>	<a class="l_k" href="functions/substr.html">substr</a><span class="s">(</span><span class="i">$str</span><span class="cm">,</span> <span class="i">$+</span>[<span class="n">0</span>]<span class="s">)</span><span class="sc">;</span></li></ol></pre><p>In Perl 5.10.0 the <code class="inline">/p</code> match operator flag and the <code class="inline"><span class="i">$</span>{<span class="w">^PREMATCH</span>}</code>
,
<code class="inline"><span class="i">$</span>{<span class="w">^MATCH</span>}</code>
, and <code class="inline"><span class="i">$</span>{<span class="w">^POSTMATCH</span>}</code>
 variables were introduced, that allowed
you to suffer the penalties only on patterns marked with <code class="inline">/p</code>.</p>
<p>In Perl 5.18.0 onwards, perl started noting the presence of each of the
three variables separately, and only copied that part of the string
required; so in</p>
<pre class="verbatim"><ol><li>    <span class="i">$`</span><span class="sc">;</span> <span class="i">$&amp;</span><span class="sc">;</span> <span class="q">&quot;abcdefgh&quot;</span> =~ <span class="q">/d/</span></li></ol></pre><p>perl would only copy the "abcd" part of the string. That could make a big
difference in something like</p>
<pre class="verbatim"><ol><li>    <span class="i">$str</span> = <span class="q">&#39;x&#39;</span> x <span class="n">1_000_000</span><span class="sc">;</span></li><li>    <span class="i">$&amp;</span><span class="sc">;</span> <span class="c"># whoops</span></li><li>    <span class="i">$str</span> =~ <span class="q">/x/g</span> <span class="c"># one char copied a million times, not a million chars</span></li></ol></pre><p>In Perl 5.20.0 a new copy-on-write system was enabled by default, which
finally fixes all performance issues with these three variables, and makes
them safe to use anywhere.</p>
<p>The <code class="inline"><span class="w">Devel::NYTProf</span></code>
 and <code class="inline"><span class="w">Devel::FindAmpersand</span></code>
 modules can help you
find uses of these problematic match variables in your code.</p>
<ul>
<li><a name="%24%3c_digits_%3e-(%241%2c-%242%2c-...)"></a><b>$&lt;<i>digits</i>&gt; ($1, $2, ...)
   </b>
<p>Contains the subpattern from the corresponding set of capturing
parentheses from the last successful pattern match, not counting patterns
matched in nested blocks that have been exited already.</p>
<p>Note there is a distinction between a capture buffer which matches
the empty string a capture buffer which is optional. Eg, <code class="inline"><span class="s">(</span><span class="w">x</span>?<span class="s">)</span></code>
 and
<code class="inline"><span class="s">(</span><span class="w">x</span><span class="s">)</span>?</code>
 The latter may be undef, the former not.</p>
<p>These variables are read-only and dynamically-scoped.</p>
<p>Mnemonic: like \digits.</p>
</li>
<li><a name="%40%7b%5eCAPTURE%7d"></a><b>@{^CAPTURE}
 </b>
<p>An array which exposes the contents of the capture buffers, if any, of
the last successful pattern match, not counting patterns matched
in nested blocks that have been exited already.</p>
<p>Note that the 0 index of @{^CAPTURE} is equivalent to $1, the 1 index
is equivalent to $2, etc.</p>
<pre class="verbatim"><ol><li>    <a class="l_k" href="functions/if.html">if</a> <span class="s">(</span><span class="q">&quot;foal&quot;</span>=~<span class="q">/(.)(.)(.)(.)/</span><span class="s">)</span> <span class="s">{</span></li><li>        <a class="l_k" href="functions/print.html">print</a> <a class="l_k" href="functions/join.html">join</a> <span class="q">&quot;-&quot;</span><span class="cm">,</span> <span class="i">@</span>{<span class="w">^CAPTURE</span>}<span class="sc">;</span></li><li>    <span class="s">}</span></li></ol></pre><p>should output "f-o-a-l".</p>
<p>See also <a href="#%24digits">$digits</a>, <a href="#%25%7b%5eCAPTURE%7d">%{^CAPTURE}</a> and <a href="#%25%7b%5eCAPTURE_ALL%7d">%{^CAPTURE_ALL}</a>.</p>
<p>Note that unlike most other regex magic variables there is no single
letter equivalent to <code class="inline"><span class="i">@</span>{<span class="w">^CAPTURE</span>}</code>
.</p>
<p>This variable was added in 5.25.7</p>
</li>
<li><a name="%24MATCH"></a><b>$MATCH</b>
</li>
<li><a name="%24%26"></a><b>$&amp;
 </b>
<p>The string matched by the last successful pattern match (not counting
any matches hidden within a BLOCK or <code class="inline"><a class="l_k" href="functions/eval.html">eval()</a></code> enclosed by the current
BLOCK).</p>
<p>See <a href="#Performance-issues">Performance issues</a> above for the serious performance implications
of using this variable (even once) in your code.</p>
<p>This variable is read-only and dynamically-scoped.</p>
<p>Mnemonic: like <code class="inline"><span class="i">&amp;</span></code>
 in some editors.</p>
</li>
<li><a name="%24%7b%5eMATCH%7d"></a><b>${^MATCH}
</b>
<p>This is similar to <code class="inline"><span class="i">$&amp;</span></code>
 (<code class="inline"><span class="i">$MATCH</span></code>
) except that it does not incur the
performance penalty associated with that variable.</p>
<p>See <a href="#Performance-issues">Performance issues</a> above.</p>
<p>In Perl v5.18 and earlier, it is only guaranteed
to return a defined value when the pattern was compiled or executed with
the <code class="inline">/p</code> modifier.  In Perl v5.20, the <code class="inline">/p</code> modifier does nothing, so
<code class="inline"><span class="i">$</span>{<span class="w">^MATCH</span>}</code>
 does the same thing as <code class="inline"><span class="i">$MATCH</span></code>
.</p>
<p>This variable was added in Perl v5.10.0.</p>
<p>This variable is read-only and dynamically-scoped.</p>
</li>
<li><a name="%24PREMATCH"></a><b>$PREMATCH</b>
</li>
<li><a name="%24%60"></a><b>$`
  </b>
<p>The string preceding whatever was matched by the last successful
pattern match, not counting any matches hidden within a BLOCK or <code class="inline"><a class="l_k" href="functions/eval.html">eval</a></code>
enclosed by the current BLOCK.</p>
<p>See <a href="#Performance-issues">Performance issues</a> above for the serious performance implications
of using this variable (even once) in your code.</p>
<p>This variable is read-only and dynamically-scoped.</p>
<p>Mnemonic: <code class="inline">`</code> often precedes a quoted string.</p>
</li>
<li><a name="%24%7b%5ePREMATCH%7d"></a><b>${^PREMATCH}
 </b>
<p>This is similar to <code class="inline"><span class="i">$`</span></code>
 ($PREMATCH) except that it does not incur the
performance penalty associated with that variable.</p>
<p>See <a href="#Performance-issues">Performance issues</a> above.</p>
<p>In Perl v5.18 and earlier, it is only guaranteed
to return a defined value when the pattern was compiled or executed with
the <code class="inline">/p</code> modifier.  In Perl v5.20, the <code class="inline">/p</code> modifier does nothing, so
<code class="inline"><span class="i">$</span>{<span class="w">^PREMATCH</span>}</code>
 does the same thing as <code class="inline"><span class="i">$PREMATCH</span></code>
.</p>
<p>This variable was added in Perl v5.10.0.</p>
<p>This variable is read-only and dynamically-scoped.</p>
</li>
<li><a name="%24POSTMATCH"></a><b>$POSTMATCH</b>
</li>
<li><a name="%24'"></a><b>$'
   </b>
<p>The string following whatever was matched by the last successful
pattern match (not counting any matches hidden within a BLOCK or <code class="inline"><a class="l_k" href="functions/eval.html">eval()</a></code>
enclosed by the current BLOCK).  Example:</p>
<pre class="verbatim"><ol><li>    <a class="l_k" href="functions/local.html">local</a> <span class="i">$_</span> = <span class="q">&#39;abcdefghi&#39;</span><span class="sc">;</span></li><li>    <span class="q">/def/</span><span class="sc">;</span></li><li>    <a class="l_k" href="functions/print.html">print</a> <span class="q">&quot;$`:$&amp;:$&#39;\n&quot;</span><span class="sc">;</span>  	<span class="c"># prints abc:def:ghi</span></li></ol></pre><p>See <a href="#Performance-issues">Performance issues</a> above for the serious performance implications
of using this variable (even once) in your code.</p>
<p>This variable is read-only and dynamically-scoped.</p>
<p>Mnemonic: <code class="inline">'</code> often follows a quoted string.</p>
</li>
<li><a name="%24%7b%5ePOSTMATCH%7d"></a><b>${^POSTMATCH}
  </b>
<p>This is similar to <code class="inline"><span class="i">$&#39;</span></code>
 (<code class="inline"><span class="i">$POSTMATCH</span></code>
) except that it does not incur the
performance penalty associated with that variable.</p>
<p>See <a href="#Performance-issues">Performance issues</a> above.</p>
<p>In Perl v5.18 and earlier, it is only guaranteed
to return a defined value when the pattern was compiled or executed with
the <code class="inline">/p</code> modifier.  In Perl v5.20, the <code class="inline">/p</code> modifier does nothing, so
<code class="inline"><span class="i">$</span>{<span class="w">^POSTMATCH</span>}</code>
 does the same thing as <code class="inline"><span class="i">$POSTMATCH</span></code>
.</p>
<p>This variable was added in Perl v5.10.0.</p>
<p>This variable is read-only and dynamically-scoped.</p>
</li>
<li><a name="%24LAST_PAREN_MATCH"></a><b>$LAST_PAREN_MATCH</b>
</li>
<li><a name="%24%2b"></a><b>$+
 </b>
<p>The text matched by the last bracket of the last successful search pattern.
This is useful if you don't know which one of a set of alternative patterns
matched.  For example:</p>
<pre class="verbatim"><ol><li>    <span class="q">/Version: (.*)|Revision: (.*)/</span> &amp;&amp; <span class="s">(</span><span class="i">$rev</span> = <span class="i">$+</span><span class="s">)</span><span class="sc">;</span></li></ol></pre><p>This variable is read-only and dynamically-scoped.</p>
<p>Mnemonic: be positive and forward looking.</p>
</li>
<li><a name="%24LAST_SUBMATCH_RESULT"></a><b>$LAST_SUBMATCH_RESULT</b>
</li>
<li><a name="%24%5eN"></a><b>$^N
 </b>
<p>The text matched by the used group most-recently closed (i.e. the group
with the rightmost closing parenthesis) of the last successful search
pattern.</p>
<p>This is primarily used inside <code class="inline">(?{...})</code> blocks for examining text
recently matched.  For example, to effectively capture text to a variable
(in addition to <code class="inline"><span class="i">$1</span></code>
, <code class="inline"><span class="i">$2</span></code>
, etc.), replace <code class="inline"><span class="s">(</span>...<span class="s">)</span></code>
 with</p>
<pre class="verbatim"><ol><li>    <span class="s">(</span><span class="q">?:(...)(?</span><span class="s">{</span> <span class="i">$var</span> = <span class="i">$^N</span> <span class="s">}</span><span class="s">)</span><span class="p">)</span></li></ol></pre><p>By setting and then using <code class="inline"><span class="i">$var</span></code>
 in this way relieves you from having to
worry about exactly which numbered set of parentheses they are.</p>
<p>This variable was added in Perl v5.8.0.</p>
<p>Mnemonic: the (possibly) Nested parenthesis that most recently closed.</p>
</li>
<li><a name="%40LAST_MATCH_END"></a><b>@LAST_MATCH_END</b>
</li>
<li><a name="%40%2b"></a><b>@+
 </b>
<p>This array holds the offsets of the ends of the last successful
submatches in the currently active dynamic scope.  <code class="inline"><span class="i">$+</span>[<span class="n">0</span>]</code>
 is
the offset into the string of the end of the entire match.  This
is the same value as what the <code class="inline"><a class="l_k" href="functions/pos.html">pos</a></code> function returns when called
on the variable that was matched against.  The <i>n</i>th element
of this array holds the offset of the <i>n</i>th submatch, so
<code class="inline"><span class="i">$+</span>[<span class="n">1</span>]</code>
 is the offset past where <code class="inline"><span class="i">$1</span></code>
 ends, <code class="inline"><span class="i">$+</span>[<span class="n">2</span>]</code>
 the offset
past where <code class="inline"><span class="i">$2</span></code>
 ends, and so on.  You can use <code class="inline"><span class="i">$#+</span></code>
 to determine
how many subgroups were in the last successful match.  See the
examples given for the <code class="inline"><span class="i">@-</span></code>
 variable.</p>
<p>This variable was added in Perl v5.6.0.</p>
</li>
<li><a name="%25%7b%5eCAPTURE%7d"></a><b>%{^CAPTURE}</b>
</li>
<li><a name="%25LAST_PAREN_MATCH"></a><b>%LAST_PAREN_MATCH</b>
</li>
<li><a name="%25%2b"></a><b>%+
  </b>
<p>Similar to <code class="inline"><span class="i">@+</span></code>
, the <code class="inline"><span class="i">%+</span></code>
 hash allows access to the named capture
buffers, should they exist, in the last successful match in the
currently active dynamic scope.</p>
<p>For example, <code class="inline"><span class="i">$+</span>{<span class="w">foo</span>}</code>
 is equivalent to <code class="inline"><span class="i">$1</span></code>
 after the following match:</p>
<pre class="verbatim"><ol><li>    <span class="q">&#39;foo&#39;</span> =~ <span class="q">/(?&lt;foo&gt;foo)/</span><span class="sc">;</span></li></ol></pre><p>The keys of the <code class="inline"><span class="i">%+</span></code>
 hash list only the names of buffers that have
captured (and that are thus associated to defined values).</p>
<p>The underlying behaviour of <code class="inline"><span class="i">%+</span></code>
 is provided by the
<a href="Tie/Hash/NamedCapture.html">Tie::Hash::NamedCapture</a> module.</p>
<p><b>Note:</b> <code class="inline"><span class="i">%-</span></code>
 and <code class="inline"><span class="i">%+</span></code>
 are tied views into a common internal hash
associated with the last successful regular expression.  Therefore mixing
iterative access to them via <code class="inline"><a class="l_k" href="functions/each.html">each</a></code> may have unpredictable results.
Likewise, if the last successful match changes, then the results may be
surprising.</p>
<p>This variable was added in Perl v5.10.0. The <code class="inline"><span class="i">%</span>{<span class="w">^CAPTURE</span>}</code>
 alias was
added in 5.25.7.</p>
<p>This variable is read-only and dynamically-scoped.</p>
</li>
<li><a name="%40LAST_MATCH_START"></a><b>@LAST_MATCH_START</b>
</li>
<li><a name="%40-"></a><b>@-
 </b>
<p><code class="inline"><span class="i">$-</span>[<span class="n">0</span>]</code>
 is the offset of the start of the last successful match.
<code class="inline">$-[</code><i>n</i><code class="inline">]</code> is the offset of the start of the substring matched by
<i>n</i>-th subpattern, or undef if the subpattern did not match.</p>
<p>Thus, after a match against <code class="inline"><span class="i">$_</span></code>
, <code class="inline"><span class="i">$&amp;</span></code>
 coincides with <code class="inline"><a class="l_k" href="functions/substr.html">substr</a> <span class="i">$_</span><span class="cm">,</span> <span class="i">$-</span>[<span class="n">0</span>]<span class="cm">,</span>
<span class="i">$+</span>[<span class="n">0</span>] - <span class="i">$-</span>[<span class="n">0</span>]</code>
.  Similarly, $<i>n</i> coincides with <code class="inline"><a class="l_k" href="functions/substr.html">substr</a> <span class="i">$_</span><span class="cm">,</span> <span class="i">$-</span>[<span class="w">n</span>]<span class="cm">,</span>
<span class="i">$+</span>[<span class="w">n</span>] - <span class="i">$-</span>[<span class="w">n</span>]</code>
 if <code class="inline"><span class="i">$-</span>[<span class="w">n</span>]</code>
 is defined, and $+ coincides with
<code class="inline"><a class="l_k" href="functions/substr.html">substr</a> <span class="i">$_</span><span class="cm">,</span> <span class="i">$-</span>[<span class="i">$#-</span>]<span class="cm">,</span> <span class="i">$+</span>[<span class="i">$#-</span>] - <span class="i">$-</span>[<span class="i">$#-</span>]</code>
.  One can use <code class="inline"><span class="i">$#-</span></code>
 to find the
last matched subgroup in the last successful match.  Contrast with
<code class="inline"><span class="i">$#+</span></code>
, the number of subgroups in the regular expression.  Compare
with <code class="inline"><span class="i">@+</span></code>
.</p>
<p>This array holds the offsets of the beginnings of the last
successful submatches in the currently active dynamic scope.
<code class="inline"><span class="i">$-</span>[<span class="n">0</span>]</code>
 is the offset into the string of the beginning of the
entire match.  The <i>n</i>th element of this array holds the offset
of the <i>n</i>th submatch, so <code class="inline"><span class="i">$-</span>[<span class="n">1</span>]</code>
 is the offset where <code class="inline"><span class="i">$1</span></code>

begins, <code class="inline"><span class="i">$-</span>[<span class="n">2</span>]</code>
 the offset where <code class="inline"><span class="i">$2</span></code>
 begins, and so on.</p>
<p>After a match against some variable <code class="inline"><span class="i">$var</span></code>
:</p>
<ul>
<li><a name="%24%60-is-the-same-as-substr(%24var%2c-0%2c-%24-%5b0%5d)"></a><b><code class="inline"><span class="i">$`</span></code>
 is the same as <code class="inline"><a class="l_k" href="functions/substr.html">substr</a><span class="s">(</span><span class="i">$var</span><span class="cm">,</span> <span class="n">0</span><span class="cm">,</span> <span class="i">$-</span>[<span class="n">0</span>]<span class="s">)</span></code>
</b>
</li>
<li><a name="%24%26-is-the-same-as-substr(%24var%2c-%24-%5b0%5d%2c-%24%2b%5b0%5d---%24-%5b0%5d)"></a><b><code class="inline"><span class="i">$&amp;</span></code>
 is the same as <code class="inline"><a class="l_k" href="functions/substr.html">substr</a><span class="s">(</span><span class="i">$var</span><span class="cm">,</span> <span class="i">$-</span>[<span class="n">0</span>]<span class="cm">,</span> <span class="i">$+</span>[<span class="n">0</span>] - <span class="i">$-</span>[<span class="n">0</span>]<span class="s">)</span></code>
</b>
</li>
<li><a name="%24'-is-the-same-as-substr(%24var%2c-%24%2b%5b0%5d)"></a><b><code class="inline"><span class="i">$&#39;</span></code>
 is the same as <code class="inline"><a class="l_k" href="functions/substr.html">substr</a><span class="s">(</span><span class="i">$var</span><span class="cm">,</span> <span class="i">$+</span>[<span class="n">0</span>]<span class="s">)</span></code>
</b>
</li>
<li><a name="%241-is-the-same-as-substr(%24var%2c-%24-%5b1%5d%2c-%24%2b%5b1%5d---%24-%5b1%5d)"></a><b><code class="inline"><span class="i">$1</span></code>
 is the same as <code class="inline"><a class="l_k" href="functions/substr.html">substr</a><span class="s">(</span><span class="i">$var</span><span class="cm">,</span> <span class="i">$-</span>[<span class="n">1</span>]<span class="cm">,</span> <span class="i">$+</span>[<span class="n">1</span>] - <span class="i">$-</span>[<span class="n">1</span>]<span class="s">)</span></code>
</b>
</li>
<li><a name="%242-is-the-same-as-substr(%24var%2c-%24-%5b2%5d%2c-%24%2b%5b2%5d---%24-%5b2%5d)"></a><b><code class="inline"><span class="i">$2</span></code>
 is the same as <code class="inline"><a class="l_k" href="functions/substr.html">substr</a><span class="s">(</span><span class="i">$var</span><span class="cm">,</span> <span class="i">$-</span>[<span class="n">2</span>]<span class="cm">,</span> <span class="i">$+</span>[<span class="n">2</span>] - <span class="i">$-</span>[<span class="n">2</span>]<span class="s">)</span></code>
</b>
</li>
<li><a name="%243-is-the-same-as-substr(%24var%2c-%24-%5b3%5d%2c-%24%2b%5b3%5d---%24-%5b3%5d)"></a><b><code class="inline"><span class="i">$3</span></code>
 is the same as <code class="inline"><a class="l_k" href="functions/substr.html">substr</a><span class="s">(</span><span class="i">$var</span><span class="cm">,</span> <span class="i">$-</span>[<span class="n">3</span>]<span class="cm">,</span> <span class="i">$+</span>[<span class="n">3</span>] - <span class="i">$-</span>[<span class="n">3</span>]<span class="s">)</span></code>
</b>
</li>
</ul>
<p>This variable was added in Perl v5.6.0.</p>
</li>
<li><a name="%25%7b%5eCAPTURE_ALL%7d"></a><b>%{^CAPTURE_ALL}
</b>
</li>
<li><a name="%25-"></a><b>%-
</b>
<p>Similar to <code class="inline"><span class="i">%+</span></code>
, this variable allows access to the named capture groups
in the last successful match in the currently active dynamic scope.  To
each capture group name found in the regular expression, it associates a
reference to an array containing the list of values captured by all
buffers with that name (should there be several of them), in the order
where they appear.</p>
<p>Here's an example:</p>
<pre class="verbatim"><ol><li>    <a class="l_k" href="functions/if.html">if</a> <span class="s">(</span><span class="q">&#39;1234&#39;</span> =~ <span class="q">/(?&lt;A&gt;1)(?&lt;B&gt;2)(?&lt;A&gt;3)(?&lt;B&gt;4)/</span><span class="s">)</span> <span class="s">{</span></li><li>        <a class="l_k" href="functions/foreach.html">foreach</a> <a class="l_k" href="functions/my.html">my</a> <span class="i">$bufname</span> <span class="s">(</span><a class="l_k" href="functions/sort.html">sort</a> <a class="l_k" href="functions/keys.html">keys</a> <span class="i">%-</span><span class="s">)</span> <span class="s">{</span></li><li>            <a class="l_k" href="functions/my.html">my</a> <span class="i">$ary</span> = <span class="i">$-</span>{<span class="i">$bufname</span>}<span class="sc">;</span></li><li>            <a class="l_k" href="functions/foreach.html">foreach</a> <a class="l_k" href="functions/my.html">my</a> <span class="i">$idx</span> <span class="s">(</span><span class="n">0</span>..<span class="i">$#$ary</span><span class="s">)</span> <span class="s">{</span></li><li>                <a class="l_k" href="functions/print.html">print</a> <span class="q">&quot;\$-{$bufname}[$idx] : &quot;</span><span class="cm">,</span></li><li>                      <span class="s">(</span><a class="l_k" href="functions/defined.html">defined</a><span class="s">(</span><span class="i">$ary</span>-&gt;[<span class="i">$idx</span>]<span class="s">)</span></li><li>                          ? <span class="q">&quot;&#39;$ary-&gt;[$idx]&#39;&quot;</span></li><li>                          <span class="co">:</span> <span class="q">&quot;undef&quot;</span><span class="s">)</span><span class="cm">,</span></li><li>                      <span class="q">&quot;\n&quot;</span><span class="sc">;</span></li><li>            <span class="s">}</span></li><li>        <span class="s">}</span></li><li>    <span class="s">}</span></li></ol></pre><p>would print out:</p>
<pre class="verbatim"><ol><li>    $-{A}[0] : '1'</li><li>    $-{A}[1] : '3'</li><li>    $-{B}[0] : '2'</li><li>    $-{B}[1] : '4'</li></ol></pre><p>The keys of the <code class="inline"><span class="i">%-</span></code>
 hash correspond to all buffer names found in
the regular expression.</p>
<p>The behaviour of <code class="inline"><span class="i">%-</span></code>
 is implemented via the
<a href="Tie/Hash/NamedCapture.html">Tie::Hash::NamedCapture</a> module.</p>
<p><b>Note:</b> <code class="inline"><span class="i">%-</span></code>
 and <code class="inline"><span class="i">%+</span></code>
 are tied views into a common internal hash
associated with the last successful regular expression.  Therefore mixing
iterative access to them via <code class="inline"><a class="l_k" href="functions/each.html">each</a></code> may have unpredictable results.
Likewise, if the last successful match changes, then the results may be
surprising.</p>
<p>This variable was added in Perl v5.10.0. The <code class="inline"><span class="i">%</span>{<span class="w">^CAPTURE_ALL</span>}</code>
 alias was
added in 5.25.7.</p>
<p>This variable is read-only and dynamically-scoped.</p>
</li>
<li><a name="%24LAST_REGEXP_CODE_RESULT"></a><b>$LAST_REGEXP_CODE_RESULT</b>
</li>
<li><a name="%24%5eR"></a><b>$^R
 </b>
<p>The result of evaluation of the last successful <code class="inline">(?{ code })</code>
regular expression assertion (see <a href="perlre.html">perlre</a>).  May be written to.</p>
<p>This variable was added in Perl 5.005.</p>
</li>
<li><a name="%24%7b%5eRE_DEBUG_FLAGS%7d"></a><b>${^RE_DEBUG_FLAGS}
</b>
<p>The current value of the regex debugging flags.  Set to 0 for no debug output
even when the <code class="inline"><span class="w">re</span> <span class="q">&#39;debug&#39;</span></code>
 module is loaded.  See <a href="re.html">re</a> for details.</p>
<p>This variable was added in Perl v5.10.0.</p>
</li>
<li><a name="%24%7b%5eRE_TRIE_MAXBUF%7d"></a><b>${^RE_TRIE_MAXBUF}
</b>
<p>Controls how certain regex optimisations are applied and how much memory they
utilize.  This value by default is 65536 which corresponds to a 512kB
temporary cache.  Set this to a higher value to trade
memory for speed when matching large alternations.  Set
it to a lower value if you want the optimisations to
be as conservative of memory as possible but still occur, and set it to a
negative value to prevent the optimisation and conserve the most memory.
Under normal situations this variable should be of no interest to you.</p>
<p>This variable was added in Perl v5.10.0.</p>
</li>
</ul>
<a name="Variables-related-to-filehandles"></a><h2>Variables related to filehandles</h2>
<p>Variables that depend on the currently selected filehandle may be set
by calling an appropriate object method on the <code class="inline"><span class="w">IO::Handle</span></code>
 object,
although this is less efficient than using the regular built-in
variables.  (Summary lines below for this contain the word HANDLE.)
First you must say</p>
<pre class="verbatim"><ol><li>    <a class="l_k" href="functions/use.html">use</a> <span class="w">IO::Handle</span><span class="sc">;</span></li></ol></pre><p>after which you may use either</p>
<pre class="verbatim"><ol><li>    <span class="w">method</span> <span class="w">HANDLE</span> <span class="w">EXPR</span></li></ol></pre><p>or more safely,</p>
<pre class="verbatim"><ol><li>    <span class="w">HANDLE</span><span class="w">-&gt;method</span><span class="s">(</span><span class="w">EXPR</span><span class="s">)</span></li></ol></pre><p>Each method returns the old value of the <code class="inline"><span class="w">IO::Handle</span></code>
 attribute.  The
methods each take an optional EXPR, which, if supplied, specifies the
new value for the <code class="inline"><span class="w">IO::Handle</span></code>
 attribute in question.  If not
supplied, most methods do nothing to the current value--except for
<code class="inline"><span class="i">autoflush</span><span class="s">(</span><span class="s">)</span></code>
, which will assume a 1 for you, just to be different.</p>
<p>Because loading in the <code class="inline"><span class="w">IO::Handle</span></code>
 class is an expensive operation,
you should learn how to use the regular built-in variables.</p>
<p>A few of these variables are considered "read-only".  This means that
if you try to assign to this variable, either directly or indirectly
through a reference, you'll raise a run-time exception.</p>
<p>You should be very careful when modifying the default values of most
special variables described in this document.  In most cases you want
to localize these variables before changing them, since if you don't,
the change may affect other modules which rely on the default values
of the special variables that you have changed.  This is one of the
correct ways to read the whole file at once:</p>
<pre class="verbatim"><ol><li>    <a class="l_k" href="functions/open.html">open</a> <a class="l_k" href="functions/my.html">my</a> <span class="i">$fh</span><span class="cm">,</span> <span class="q">&quot;&lt;&quot;</span><span class="cm">,</span> <span class="q">&quot;foo&quot;</span> or <a class="l_k" href="functions/die.html">die</a> <span class="i">$!</span><span class="sc">;</span></li><li>    <a class="l_k" href="functions/local.html">local</a> <span class="i">$/</span><span class="sc">;</span> <span class="c"># enable localized slurp mode</span></li><li>    <a class="l_k" href="functions/my.html">my</a> <span class="i">$content</span> = <span class="q">&lt;$fh&gt;</span><span class="sc">;</span></li><li>    <a class="l_k" href="functions/close.html">close</a> <span class="i">$fh</span><span class="sc">;</span></li></ol></pre><p>But the following code is quite bad:</p>
<pre class="verbatim"><ol><li>    <a class="l_k" href="functions/open.html">open</a> <a class="l_k" href="functions/my.html">my</a> <span class="i">$fh</span><span class="cm">,</span> <span class="q">&quot;&lt;&quot;</span><span class="cm">,</span> <span class="q">&quot;foo&quot;</span> or <a class="l_k" href="functions/die.html">die</a> <span class="i">$!</span><span class="sc">;</span></li><li>    <a class="l_k" href="functions/undef.html">undef</a> <span class="i">$/</span><span class="sc">;</span> <span class="c"># enable slurp mode</span></li><li>    <a class="l_k" href="functions/my.html">my</a> <span class="i">$content</span> = <span class="q">&lt;$fh&gt;</span><span class="sc">;</span></li><li>    <a class="l_k" href="functions/close.html">close</a> <span class="i">$fh</span><span class="sc">;</span></li></ol></pre><p>since some other module, may want to read data from some file in the
default "line mode", so if the code we have just presented has been
executed, the global value of <code class="inline"><span class="i">$/</span></code>
 is now changed for any other code
running inside the same Perl interpreter.</p>
<p>Usually when a variable is localized you want to make sure that this
change affects the shortest scope possible.  So unless you are already
inside some short <code class="inline"><span class="s">{</span><span class="s">}</span></code>
 block, you should create one yourself.  For
example:</p>
<pre class="verbatim"><ol><li>    <a class="l_k" href="functions/my.html">my</a> <span class="i">$content</span> = <span class="q">&#39;&#39;</span><span class="sc">;</span></li><li>    <a class="l_k" href="functions/open.html">open</a> <a class="l_k" href="functions/my.html">my</a> <span class="i">$fh</span><span class="cm">,</span> <span class="q">&quot;&lt;&quot;</span><span class="cm">,</span> <span class="q">&quot;foo&quot;</span> <a class="l_k" href="functions/or.html">or</a> <a class="l_k" href="functions/die.html">die</a> <span class="i">$!</span><span class="sc">;</span></li><li>    <span class="s">{</span></li><li>	<a class="l_k" href="functions/local.html">local</a> <span class="i">$/</span><span class="sc">;</span></li><li>	<span class="i">$content</span> = <span class="q">&lt;$fh&gt;</span><span class="sc">;</span></li><li>    <span class="s">}</span></li><li>    <a class="l_k" href="functions/close.html">close</a> <span class="i">$fh</span><span class="sc">;</span></li></ol></pre><p>Here is an example of how your own code can go broken:</p>
<pre class="verbatim"><ol><li>    <a class="l_k" href="functions/for.html">for</a> <span class="s">(</span> <span class="n">1</span>..<span class="n">3</span> <span class="s">)</span><span class="s">{</span></li><li>	<span class="i">$\</span> = <span class="q">&quot;\r\n&quot;</span><span class="sc">;</span></li><li>	<span class="i">nasty_break</span><span class="s">(</span><span class="s">)</span><span class="sc">;</span></li><li>	<a class="l_k" href="functions/print.html">print</a> <span class="q">&quot;$_&quot;</span><span class="sc">;</span></li><li>    <span class="s">}</span></li><li></li><li><a name="nasty_break"></a>    sub <span class="m">nasty_break</span> <span class="s">{</span></li><li>	<span class="i">$\</span> = <span class="q">&quot;\f&quot;</span><span class="sc">;</span></li><li>	<span class="c"># do something with $_</span></li><li>    <span class="s">}</span></li></ol></pre><p>You probably expect this code to print the equivalent of</p>
<pre class="verbatim"><ol><li>    <span class="q">&quot;1\r\n2\r\n3\r\n&quot;</span></li></ol></pre><p>but instead you get:</p>
<pre class="verbatim"><ol><li>    <span class="q">&quot;1\f2\f3\f&quot;</span></li></ol></pre><p>Why? Because <code class="inline"><span class="i">nasty_break</span><span class="s">(</span><span class="s">)</span></code>
 modifies <code class="inline"><span class="i">$\</span></code>
 without localizing it
first.  The value you set in  <code class="inline"><span class="i">nasty_break</span><span class="s">(</span><span class="s">)</span></code>
 is still there when you
return.  The fix is to add <code class="inline"><a class="l_k" href="functions/local.html">local()</a></code> so the value doesn't leak out of
<code class="inline"><span class="i">nasty_break</span><span class="s">(</span><span class="s">)</span></code>
:</p>
<pre class="verbatim"><ol><li>    <a class="l_k" href="functions/local.html">local</a> <span class="i">$\</span> = <span class="q">&quot;\f&quot;</span><span class="sc">;</span></li></ol></pre><p>It's easy to notice the problem in such a short example, but in more
complicated code you are looking for trouble if you don't localize
changes to the special variables.</p>
<ul>
<li><a name="%24ARGV"></a><b>$ARGV
</b>
<p>Contains the name of the current file when reading from <code class="inline">&lt;&gt;</code>
.</p>
</li>
<li><a name="%40ARGV"></a><b>@ARGV
</b>
<p>The array <code class="inline"><span class="i">@ARGV</span></code>
 contains the command-line arguments intended for
the script.  <code class="inline"><span class="i">$#ARGV</span></code>
 is generally the number of arguments minus
one, because <code class="inline"><span class="i">$ARGV</span>[<span class="n">0</span>]</code>
 is the first argument, <i>not</i> the program's
command name itself.  See <a href="#%240">$0</a> for the command name.</p>
</li>
<li><a name="ARGV"></a><b>ARGV
</b>
<p>The special filehandle that iterates over command-line filenames in
<code class="inline"><span class="i">@ARGV</span></code>
.  Usually written as the null filehandle in the angle operator
<code class="inline">&lt;&gt;</code>
.  Note that currently <code class="inline"><span class="w">ARGV</span></code>
 only has its magical effect
within the <code class="inline">&lt;&gt;</code>
 operator; elsewhere it is just a plain filehandle
corresponding to the last file opened by <code class="inline">&lt;&gt;</code>
.  In particular,
passing <code class="inline">\<span class="i">*ARGV</span></code>
 as a parameter to a function that expects a filehandle
may not cause your function to automatically read the contents of all the
files in <code class="inline"><span class="i">@ARGV</span></code>
.</p>
</li>
<li><a name="ARGVOUT"></a><b>ARGVOUT
</b>
<p>The special filehandle that points to the currently open output file
when doing edit-in-place processing with <b>-i</b>.  Useful when you have
to do a lot of inserting and don't want to keep modifying <code class="inline"><span class="i">$_</span></code>
.  See
<a href="perlrun.html">perlrun</a> for the <b>-i</b> switch.</p>
</li>
<li><a name="IO%3a%3aHandle-%3eoutput_field_separator(-EXPR-)"></a><b>IO::Handle-&gt;output_field_separator( EXPR )</b>
</li>
<li><a name="%24OUTPUT_FIELD_SEPARATOR"></a><b>$OUTPUT_FIELD_SEPARATOR</b>
</li>
<li><a name="%24OFS"></a><b>$OFS</b>
</li>
<li><a name="%24%2c"></a><b>$,
  </b>
<p>The output field separator for the print operator.  If defined, this
value is printed between each of print's arguments.  Default is <code class="inline"><a class="l_k" href="functions/undef.html">undef</a></code>.</p>
<p>You cannot call <code class="inline"><span class="i">output_field_separator</span><span class="s">(</span><span class="s">)</span></code>
 on a handle, only as a
static method.  See <a href="IO/Handle.html">IO::Handle</a>.</p>
<p>Mnemonic: what is printed when there is a "," in your print statement.</p>
</li>
<li><a name="HANDLE-%3einput_line_number(-EXPR-)"></a><b>HANDLE-&gt;input_line_number( EXPR )</b>
</li>
<li><a name="%24INPUT_LINE_NUMBER"></a><b>$INPUT_LINE_NUMBER</b>
</li>
<li><a name="%24NR"></a><b>$NR</b>
</li>
<li><a name="%24."></a><b>$.
   </b>
<p>Current line number for the last filehandle accessed.</p>
<p>Each filehandle in Perl counts the number of lines that have been read
from it.  (Depending on the value of <code class="inline"><span class="i">$/</span></code>
, Perl's idea of what
constitutes a line may not match yours.)  When a line is read from a
filehandle (via <code class="inline"><a class="l_k" href="functions/readline.html">readline()</a></code> or <code class="inline">&lt;&gt;</code>
), or when <code class="inline"><a class="l_k" href="functions/tell.html">tell()</a></code> or
<code class="inline"><a class="l_k" href="functions/seek.html">seek()</a></code> is called on it, <code class="inline"><span class="i">$.</span></code>
 becomes an alias to the line counter
for that filehandle.</p>
<p>You can adjust the counter by assigning to <code class="inline"><span class="i">$.</span></code>
, but this will not
actually move the seek pointer.  <i>Localizing <code class="inline"><span class="i">$.</span></code>
 will not localize
the filehandle's line count</i>.  Instead, it will localize perl's notion
of which filehandle <code class="inline"><span class="i">$.</span></code>
 is currently aliased to.</p>
<p><code class="inline"><span class="i">$.</span></code>
 is reset when the filehandle is closed, but <b>not</b> when an open
filehandle is reopened without an intervening <code class="inline"><a class="l_k" href="functions/close.html">close()</a></code>.  For more
details, see <a href="perlop.html#I%2fO-Operators">I/O Operators in perlop</a>.  Because <code class="inline">&lt;&gt;</code>
 never does
an explicit close, line numbers increase across <code class="inline"><span class="w">ARGV</span></code>
 files (but see
examples in <a href="functions/eof.html">eof</a>).</p>
<p>You can also use <code class="inline"><span class="w">HANDLE</span><span class="w">-&gt;input_line_number</span><span class="s">(</span><span class="w">EXPR</span><span class="s">)</span></code>
 to access the
line counter for a given filehandle without having to worry about
which handle you last accessed.</p>
<p>Mnemonic: many programs use "." to mean the current line number.</p>
</li>
<li><a name="IO%3a%3aHandle-%3einput_record_separator(-EXPR-)"></a><b>IO::Handle-&gt;input_record_separator( EXPR )</b>
</li>
<li><a name="%24INPUT_RECORD_SEPARATOR"></a><b>$INPUT_RECORD_SEPARATOR</b>
</li>
<li><a name="%24RS"></a><b>$RS</b>
</li>
<li><a name="%24%2f"></a><b>$/
  </b>
<p>The input record separator, newline by default.  This influences Perl's
idea of what a "line" is.  Works like <b>awk</b>'s RS variable, including
treating empty lines as a terminator if set to the null string (an
empty line cannot contain any spaces or tabs).  You may set it to a
multi-character string to match a multi-character terminator, or to
<code class="inline"><a class="l_k" href="functions/undef.html">undef</a></code> to read through the end of file.  Setting it to <code class="inline"><span class="q">&quot;\n\n&quot;</span></code>

means something slightly different than setting to <code class="inline"><span class="q">&quot;&quot;</span></code>
, if the file
contains consecutive empty lines.  Setting to <code class="inline"><span class="q">&quot;&quot;</span></code>
 will treat two or
more consecutive empty lines as a single empty line.  Setting to
<code class="inline"><span class="q">&quot;\n\n&quot;</span></code>
 will blindly assume that the next input character belongs to
the next paragraph, even if it's a newline.</p>
<pre class="verbatim"><ol><li>    <a class="l_k" href="functions/local.html">local</a> <span class="i">$/</span><span class="sc">;</span>           <span class="c"># enable &quot;slurp&quot; mode</span></li><li>    <a class="l_k" href="functions/local.html">local</a> <span class="i">$_</span> = <span class="q">&lt;FH&gt;</span><span class="sc">;</span>    <span class="c"># whole file now here</span></li><li>    <span class="q">s/\n[ \t]+/ /g</span><span class="sc">;</span></li></ol></pre><p>Remember: the value of <code class="inline"><span class="i">$/</span></code>
 is a string, not a regex.  <b>awk</b> has to
be better for something. :-)</p>
<p>Setting <code class="inline"><span class="i">$/</span></code>
 to a reference to an integer, scalar containing an
integer, or scalar that's convertible to an integer will attempt to
read records instead of lines, with the maximum record size being the
referenced integer number of characters.  So this:</p>
<pre class="verbatim"><ol><li>    <a class="l_k" href="functions/local.html">local</a> <span class="i">$/</span> = \<span class="n">32768</span><span class="sc">;</span> <span class="c"># or \&quot;32768&quot;, or \$var_containing_32768</span></li><li>    <a class="l_k" href="functions/open.html">open</a> <a class="l_k" href="functions/my.html">my</a> <span class="i">$fh</span><span class="cm">,</span> <span class="q">&quot;&lt;&quot;</span><span class="cm">,</span> <span class="i">$myfile</span> or <a class="l_k" href="functions/die.html">die</a> <span class="i">$!</span><span class="sc">;</span></li><li>    <a class="l_k" href="functions/local.html">local</a> <span class="i">$_</span> = <span class="q">&lt;$fh&gt;</span><span class="sc">;</span></li></ol></pre><p>will read a record of no more than 32768 characters from $fh.  If you're
not reading from a record-oriented file (or your OS doesn't have
record-oriented files), then you'll likely get a full chunk of data
with every read.  If a record is larger than the record size you've
set, you'll get the record back in pieces.  Trying to set the record
size to zero or less is deprecated and will cause $/ to have the value
of "undef", which will cause reading in the (rest of the) whole file.</p>
<p>As of 5.19.9 setting <code class="inline"><span class="i">$/</span></code>
 to any other form of reference will throw a
fatal exception. This is in preparation for supporting new ways to set
<code class="inline"><span class="i">$/</span></code>
 in the future.</p>
<p>On VMS only, record reads bypass PerlIO layers and any associated
buffering, so you must not mix record and non-record reads on the
same filehandle.  Record mode mixes with line mode only when the
same buffering layer is in use for both modes.</p>
<p>You cannot call <code class="inline"><span class="i">input_record_separator</span><span class="s">(</span><span class="s">)</span></code>
 on a handle, only as a
static method.  See <a href="IO/Handle.html">IO::Handle</a>.</p>
<p>See also <a href="perlport.html#Newlines">Newlines in perlport</a>.  Also see <a href="#%24.">$.</a>.</p>
<p>Mnemonic: / delimits line boundaries when quoting poetry.</p>
</li>
<li><a name="IO%3a%3aHandle-%3eoutput_record_separator(-EXPR-)"></a><b>IO::Handle-&gt;output_record_separator( EXPR )</b>
</li>
<li><a name="%24OUTPUT_RECORD_SEPARATOR"></a><b>$OUTPUT_RECORD_SEPARATOR</b>
</li>
<li><a name="%24ORS"></a><b>$ORS</b>
</li>
<li><a name="%24%5c"></a><b>$\
  </b>
<p>The output record separator for the print operator.  If defined, this
value is printed after the last of print's arguments.  Default is <code class="inline"><a class="l_k" href="functions/undef.html">undef</a></code>.</p>
<p>You cannot call <code class="inline"><span class="i">output_record_separator</span><span class="s">(</span><span class="s">)</span></code>
 on a handle, only as a
static method.  See <a href="IO/Handle.html">IO::Handle</a>.</p>
<p>Mnemonic: you set <code class="inline"><span class="i">$\</span></code>
 instead of adding "\n" at the end of the print.
Also, it's just like <code class="inline"><span class="i">$/</span></code>
, but it's what you get "back" from Perl.</p>
</li>
<li><a name="HANDLE-%3eautoflush(-EXPR-)"></a><b>HANDLE-&gt;autoflush( EXPR )</b>
</li>
<li><a name="%24OUTPUT_AUTOFLUSH"></a><b>$OUTPUT_AUTOFLUSH</b>
</li>
<li><a name="%24%7c"></a><b>$|
   </b>
<p>If set to nonzero, forces a flush right away and after every write or
print on the currently selected output channel.  Default is 0
(regardless of whether the channel is really buffered by the system or
not; <code class="inline"><span class="i">$|</span></code>
 tells you only whether you've asked Perl explicitly to
flush after each write).  STDOUT will typically be line buffered if
output is to the terminal and block buffered otherwise.  Setting this
variable is useful primarily when you are outputting to a pipe or
socket, such as when you are running a Perl program under <b>rsh</b> and
want to see the output as it's happening.  This has no effect on input
buffering.  See <a href="functions/getc.html">getc</a> for that.  See <a href="functions/select.html">select</a> on
how to select the output channel.  See also <a href="IO/Handle.html">IO::Handle</a>.</p>
<p>Mnemonic: when you want your pipes to be piping hot.</p>
</li>
<li><a name="%24%7b%5eLAST_FH%7d"></a><b>${^LAST_FH}
</b>
<p>This read-only variable contains a reference to the last-read filehandle.
This is set by <code class="inline"><span class="q">&lt;HANDLE&gt;</span></code>
, <code class="inline"><a class="l_k" href="functions/readline.html">readline</a></code>, <code class="inline"><a class="l_k" href="functions/tell.html">tell</a></code>, <code class="inline"><a class="l_k" href="functions/eof.html">eof</a></code> and <code class="inline"><a class="l_k" href="functions/seek.html">seek</a></code>.
This is the same handle that <code class="inline"><span class="i">$.</span></code>
 and <code class="inline"><a class="l_k" href="functions/tell.html">tell</a></code> and <code class="inline"><a class="l_k" href="functions/eof.html">eof</a></code> without arguments
use.  It is also the handle used when Perl appends ", &lt;STDIN&gt; line 1" to
an error or warning message.</p>
<p>This variable was added in Perl v5.18.0.</p>
</li>
</ul>
<a name="Variables-related-to-formats"></a><h3>Variables related to formats</h3>
<p>The special variables for formats are a subset of those for
filehandles.  See <a href="perlform.html">perlform</a> for more information about Perl's
formats.</p>
<ul>
<li><a name="%24ACCUMULATOR"></a><b>$ACCUMULATOR</b>
</li>
<li><a name="%24%5eA"></a><b>$^A
 </b>
<p>The current value of the <code class="inline"><a class="l_k" href="functions/write.html">write()</a></code> accumulator for <code class="inline"><a class="l_k" href="functions/format.html">format()</a></code> lines.
A format contains <code class="inline"><a class="l_k" href="functions/formline.html">formline()</a></code> calls that put their result into
<code class="inline"><span class="i">$^A</span></code>
.  After calling its format, <code class="inline"><a class="l_k" href="functions/write.html">write()</a></code> prints out the contents
of <code class="inline"><span class="i">$^A</span></code>
 and empties.  So you never really see the contents of <code class="inline"><span class="i">$^A</span></code>

unless you call <code class="inline"><a class="l_k" href="functions/formline.html">formline()</a></code> yourself and then look at it.  See
<a href="perlform.html">perlform</a> and <a href="functions/formline.html">formline PICTURE,LIST</a>.</p>
</li>
<li><a name="IO%3a%3aHandle-%3eformat_formfeed(EXPR)"></a><b>IO::Handle-&gt;format_formfeed(EXPR)</b>
</li>
<li><a name="%24FORMAT_FORMFEED"></a><b>$FORMAT_FORMFEED</b>
</li>
<li><a name="%24%5eL"></a><b>$^L
 </b>
<p>What formats output as a form feed.  The default is <code class="inline">\<span class="w">f</span></code>
.</p>
<p>You cannot call <code class="inline"><span class="i">format_formfeed</span><span class="s">(</span><span class="s">)</span></code>
 on a handle, only as a static
method.  See <a href="IO/Handle.html">IO::Handle</a>.</p>
</li>
<li><a name="HANDLE-%3eformat_page_number(EXPR)"></a><b>HANDLE-&gt;format_page_number(EXPR)</b>
</li>
<li><a name="%24FORMAT_PAGE_NUMBER"></a><b>$FORMAT_PAGE_NUMBER</b>
</li>
<li><a name="%24%25"></a><b>$%
 </b>
<p>The current page number of the currently selected output channel.</p>
<p>Mnemonic: <code class="inline"><span class="i">%</span></code>
 is page number in <b>nroff</b>.</p>
</li>
<li><a name="HANDLE-%3eformat_lines_left(EXPR)"></a><b>HANDLE-&gt;format_lines_left(EXPR)</b>
</li>
<li><a name="%24FORMAT_LINES_LEFT"></a><b>$FORMAT_LINES_LEFT</b>
</li>
<li><a name="%24-"></a><b>$-
 </b>
<p>The number of lines left on the page of the currently selected output
channel.</p>
<p>Mnemonic: lines_on_page - lines_printed.</p>
</li>
<li><a name="IO%3a%3aHandle-%3eformat_line_break_characters-EXPR"></a><b>IO::Handle-&gt;format_line_break_characters EXPR</b>
</li>
<li><a name="%24FORMAT_LINE_BREAK_CHARACTERS"></a><b>$FORMAT_LINE_BREAK_CHARACTERS</b>
</li>
<li><a name="%24%3a"></a><b>$:
 </b>
<p>The current set of characters after which a string may be broken to
fill continuation fields (starting with <code class="inline">^</code>) in a format.  The default is
" \n-", to break on a space, newline, or a hyphen.</p>
<p>You cannot call <code class="inline"><span class="i">format_line_break_characters</span><span class="s">(</span><span class="s">)</span></code>
 on a handle, only as
a static method.  See <a href="IO/Handle.html">IO::Handle</a>.</p>
<p>Mnemonic: a "colon" in poetry is a part of a line.</p>
</li>
<li><a name="HANDLE-%3eformat_lines_per_page(EXPR)"></a><b>HANDLE-&gt;format_lines_per_page(EXPR)</b>
</li>
<li><a name="%24FORMAT_LINES_PER_PAGE"></a><b>$FORMAT_LINES_PER_PAGE</b>
</li>
<li><a name="%24%3d"></a><b>$=
 </b>
<p>The current page length (printable lines) of the currently selected
output channel.  The default is 60.</p>
<p>Mnemonic: = has horizontal lines.</p>
</li>
<li><a name="HANDLE-%3eformat_top_name(EXPR)"></a><b>HANDLE-&gt;format_top_name(EXPR)</b>
</li>
<li><a name="%24FORMAT_TOP_NAME"></a><b>$FORMAT_TOP_NAME</b>
</li>
<li><a name="%24%5e"></a><b>$^
 </b>
<p>The name of the current top-of-page format for the currently selected
output channel.  The default is the name of the filehandle with <code class="inline"><span class="w">_TOP</span></code>

appended.  For example, the default format top name for the <code class="inline"><span class="w">STDOUT</span></code>

filehandle is <code class="inline"><span class="w">STDOUT_TOP</span></code>
.</p>
<p>Mnemonic: points to top of page.</p>
</li>
<li><a name="HANDLE-%3eformat_name(EXPR)"></a><b>HANDLE-&gt;format_name(EXPR)</b>
</li>
<li><a name="%24FORMAT_NAME"></a><b>$FORMAT_NAME</b>
</li>
<li><a name="%24~"></a><b>$~
 </b>
<p>The name of the current report format for the currently selected
output channel.  The default format name is the same as the filehandle
name.  For example, the default format name for the <code class="inline"><span class="w">STDOUT</span></code>

filehandle is just <code class="inline"><span class="w">STDOUT</span></code>
.</p>
<p>Mnemonic: brother to <code class="inline"><span class="i">$^</span></code>
.</p>
</li>
</ul>
<a name="Error-Variables"></a><h2>Error Variables
 </h2>
<p>The variables <code class="inline"><span class="i">$@</span></code>
, <code class="inline"><span class="i">$!</span></code>
, <code class="inline"><span class="i">$^E</span></code>
, and <code class="inline"><span class="i">$?</span></code>
 contain information
about different types of error conditions that may appear during
execution of a Perl program.  The variables are shown ordered by
the "distance" between the subsystem which reported the error and
the Perl process.  They correspond to errors detected by the Perl
interpreter, C library, operating system, or an external program,
respectively.</p>
<p>To illustrate the differences between these variables, consider the
following Perl expression, which uses a single-quoted string.  After
execution of this statement, perl may have set all four special error
variables:</p>
<pre class="verbatim"><ol><li>    <a class="l_k" href="functions/eval.html">eval</a> <span class="q">q{</span></li><li>	<span class="q">	open my $pipe, &quot;/cdrom/install |&quot; or die $!;</span></li><li>	<span class="q">	my @res = &lt;$pipe&gt;;</span></li><li>	<span class="q">	close $pipe or die &quot;bad pipe: $?, $!&quot;;</span></li><li>    <span class="q">    }</span><span class="sc">;</span></li></ol></pre><p>When perl executes the <code class="inline"><a class="l_k" href="functions/eval.html">eval()</a></code> expression, it translates the
<code class="inline"><a class="l_k" href="functions/open.html">open()</a></code>, <code class="inline"><span class="q">&lt;PIPE&gt;</span></code>
, and <code class="inline"><a class="l_k" href="functions/close.html">close</a></code> calls in the C run-time library
and thence to the operating system kernel.  perl sets <code class="inline"><span class="i">$!</span></code>
 to
the C library's <code class="inline"><span class="w">errno</span></code>
 if one of these calls fails.</p>
<p><code class="inline"><span class="i">$@</span></code>
 is set if the string to be <code class="inline"><a class="l_k" href="functions/eval.html">eval</a></code>-ed did not compile (this may
happen if <code class="inline"><a class="l_k" href="functions/open.html">open</a></code> or <code class="inline"><a class="l_k" href="functions/close.html">close</a></code> were imported with bad prototypes), or
if Perl code executed during evaluation <code class="inline"><a class="l_k" href="functions/die.html">die()</a></code>d.  In these cases the
value of <code class="inline"><span class="i">$@</span></code>
 is the compile error, or the argument to <code class="inline"><a class="l_k" href="functions/die.html">die</a></code> (which
will interpolate <code class="inline"><span class="i">$!</span></code>
 and <code class="inline"><span class="i">$?</span></code>
).  (See also <a href="Fatal.html">Fatal</a>, though.)</p>
<p>Under a few operating systems, <code class="inline"><span class="i">$^E</span></code>
 may contain a more verbose error
indicator, such as in this case, "CDROM tray not closed."  Systems that
do not support extended error messages leave <code class="inline"><span class="i">$^E</span></code>
 the same as <code class="inline"><span class="i">$!</span></code>
.</p>
<p>Finally, <code class="inline"><span class="i">$?</span></code>
 may be set to a non-0 value if the external program
<i>/cdrom/install</i> fails.  The upper eight bits reflect specific error
conditions encountered by the program (the program's <code class="inline"><a class="l_k" href="functions/exit.html">exit()</a></code> value).
The lower eight bits reflect mode of failure, like signal death and
core dump information.  See <i>wait(2)</i> for details.  In contrast to
<code class="inline"><span class="i">$!</span></code>
 and <code class="inline"><span class="i">$^E</span></code>
, which are set only if an error condition is detected,
the variable <code class="inline"><span class="i">$?</span></code>
 is set on each <code class="inline"><a class="l_k" href="functions/wait.html">wait</a></code> or pipe <code class="inline"><a class="l_k" href="functions/close.html">close</a></code>,
overwriting the old value.  This is more like <code class="inline"><span class="i">$@</span></code>
, which on every
<code class="inline"><a class="l_k" href="functions/eval.html">eval()</a></code> is always set on failure and cleared on success.</p>
<p>For more details, see the individual descriptions at <code class="inline"><span class="i">$@</span></code>
, <code class="inline"><span class="i">$!</span></code>
,
<code class="inline"><span class="i">$^E</span></code>
, and <code class="inline"><span class="i">$?</span></code>
.</p>
<ul>
<li><a name="%24%7b%5eCHILD_ERROR_NATIVE%7d"></a><b>${^CHILD_ERROR_NATIVE}
</b>
<p>The native status returned by the last pipe close, backtick (<code class="inline"><span class="q">``</span></code>
)
command, successful call to <code class="inline"><a class="l_k" href="functions/wait.html">wait()</a></code> or <code class="inline"><a class="l_k" href="functions/waitpid.html">waitpid()</a></code>, or from the
<code class="inline"><a class="l_k" href="functions/system.html">system()</a></code> operator.  On POSIX-like systems this value can be decoded
with the WIFEXITED, WEXITSTATUS, WIFSIGNALED, WTERMSIG, WIFSTOPPED,
WSTOPSIG and WIFCONTINUED functions provided by the <a href="POSIX.html">POSIX</a> module.</p>
<p>Under VMS this reflects the actual VMS exit status; i.e. it is the
same as <code class="inline"><span class="i">$?</span></code>
 when the pragma <code class="inline"><a class="l_k" href="functions/use.html">use</a> <span class="w">vmsish</span> <span class="q">&#39;status&#39;</span></code>
 is in effect.</p>
<p>This variable was added in Perl v5.10.0.</p>
</li>
<li><a name="%24EXTENDED_OS_ERROR"></a><b>$EXTENDED_OS_ERROR</b>
</li>
<li><a name="%24%5eE"></a><b>$^E
 </b>
<p>Error information specific to the current operating system.  At the
moment, this differs from <code class="inline"><a href="#%24!">$!</a></code> under only VMS, OS/2, and Win32 (and
for MacPerl).  On all other platforms, <code class="inline"><span class="i">$^E</span></code>
 is always just the same
as <code class="inline"><span class="i">$!</span></code>
.</p>
<p>Under VMS, <code class="inline"><span class="i">$^E</span></code>
 provides the VMS status value from the last system
error.  This is more specific information about the last system error
than that provided by <code class="inline"><span class="i">$!</span></code>
.  This is particularly important when <code class="inline"><span class="i">$!</span></code>

is set to <b>EVMSERR</b>.</p>
<p>Under OS/2, <code class="inline"><span class="i">$^E</span></code>
 is set to the error code of the last call to OS/2
API either via CRT, or directly from perl.</p>
<p>Under Win32, <code class="inline"><span class="i">$^E</span></code>
 always returns the last error information reported
by the Win32 call <code class="inline"><span class="i">GetLastError</span><span class="s">(</span><span class="s">)</span></code>
 which describes the last error
from within the Win32 API.  Most Win32-specific code will report errors
via <code class="inline"><span class="i">$^E</span></code>
.  ANSI C and Unix-like calls set <code class="inline"><span class="w">errno</span></code>
 and so most
portable Perl code will report errors via <code class="inline"><span class="i">$!</span></code>
.</p>
<p>Caveats mentioned in the description of <code class="inline"><a href="#%24!">$!</a></code> generally apply to
<code class="inline"><span class="i">$^E</span></code>
, also.</p>
<p>This variable was added in Perl 5.003.</p>
<p>Mnemonic: Extra error explanation.</p>
</li>
<li><a name="%24EXCEPTIONS_BEING_CAUGHT"></a><b>$EXCEPTIONS_BEING_CAUGHT</b>
</li>
<li><a name="%24%5eS"></a><b>$^S
 </b>
<p>Current state of the interpreter.</p>
<pre class="verbatim"><ol><li>	<span class="i">$^S</span>         <span class="w">State</span></li><li>	---------   -------------------------------------</li><li>	<a class="l_k" href="functions/undef.html">undef</a>       <span class="w">Parsing</span> <span class="w">module</span><span class="cm">,</span> <a class="l_k" href="functions/eval.html">eval</a><span class="cm">,</span> <a class="l_k" href="functions/or.html">or</a> <span class="w">main</span> <span class="w">program</span></li><li>	<span class="w">true</span> <span class="s">(</span><span class="n">1</span><span class="s">)</span>    <span class="w">Executing</span> <span class="w">an</span> <a class="l_k" href="functions/eval.html">eval</a></li><li>	<span class="w">false</span> <span class="s">(</span><span class="n">0</span><span class="s">)</span>   <span class="w">Otherwise</span></li></ol></pre><p>The first state may happen in <code class="inline"><span class="i">$SIG</span>{<span class="w">__DIE__</span>}</code>
 and <code class="inline"><span class="i">$SIG</span>{<span class="w">__WARN__</span>}</code>

handlers.</p>
<p>The English name $EXCEPTIONS_BEING_CAUGHT is slightly misleading, because
the <code class="inline"><a class="l_k" href="functions/undef.html">undef</a></code> value does not indicate whether exceptions are being caught,
since compilation of the main program does not catch exceptions.</p>
<p>This variable was added in Perl 5.004.</p>
</li>
<li><a name="%24WARNING"></a><b>$WARNING</b>
</li>
<li><a name="%24%5eW"></a><b>$^W
 </b>
<p>The current value of the warning switch, initially true if <b>-w</b> was
used, false otherwise, but directly modifiable.</p>
<p>See also <a href="warnings.html">warnings</a>.</p>
<p>Mnemonic: related to the <b>-w</b> switch.</p>
</li>
<li><a name="%24%7b%5eWARNING_BITS%7d"></a><b>${^WARNING_BITS}
</b>
<p>The current set of warning checks enabled by the <code class="inline"><a class="l_k" href="functions/use.html">use</a> <span class="w">warnings</span></code>
 pragma.
It has the same scoping as the <code class="inline"><span class="i">$^H</span></code>
 and <code class="inline"><span class="i">%^H</span></code>
 variables.  The exact
values are considered internal to the <a href="warnings.html">warnings</a> pragma and may change
between versions of Perl.</p>
<p>This variable was added in Perl v5.6.0.</p>
</li>
<li><a name="%24OS_ERROR"></a><b>$OS_ERROR</b>
</li>
<li><a name="%24ERRNO"></a><b>$ERRNO</b>
</li>
<li><a name="%24!"></a><b>$!
  </b>
<p>When referenced, <code class="inline"><span class="i">$!</span></code>
 retrieves the current value
of the C <code class="inline"><span class="w">errno</span></code>
 integer variable.
If <code class="inline"><span class="i">$!</span></code>
 is assigned a numerical value, that value is stored in <code class="inline"><span class="w">errno</span></code>
.
When referenced as a string, <code class="inline"><span class="i">$!</span></code>
 yields the system error string
corresponding to <code class="inline"><span class="w">errno</span></code>
.</p>
<p>Many system or library calls set <code class="inline"><span class="w">errno</span></code>
 if they fail,
to indicate the cause of failure.  They usually do <b>not</b>
set <code class="inline"><span class="w">errno</span></code>
 to zero if they succeed.  This means <code class="inline"><span class="w">errno</span></code>
,
hence <code class="inline"><span class="i">$!</span></code>
, is meaningful only <i>immediately</i> after a <b>failure</b>:</p>
<pre class="verbatim"><ol><li>    <a class="l_k" href="functions/if.html">if</a> <span class="s">(</span><a class="l_k" href="functions/open.html">open</a> <a class="l_k" href="functions/my.html">my</a> <span class="i">$fh</span><span class="cm">,</span> <span class="q">&quot;&lt;&quot;</span><span class="cm">,</span> <span class="i">$filename</span><span class="s">)</span> <span class="s">{</span></li><li>		<span class="c"># Here $! is meaningless.</span></li><li>		...</li><li>    <span class="s">}</span></li><li>    <a class="l_k" href="functions/else.html">else</a> <span class="s">{</span></li><li>		<span class="c"># ONLY here is $! meaningful.</span></li><li>		...</li><li>		<span class="c"># Already here $! might be meaningless.</span></li><li>    <span class="s">}</span></li><li>    <span class="c"># Since here we might have either success or failure,</span></li><li>    <span class="c"># $! is meaningless.</span></li></ol></pre><p>Here, <i>meaningless</i> means that <code class="inline"><span class="i">$!</span></code>
 may be unrelated to the outcome
of the <code class="inline"><a class="l_k" href="functions/open.html">open()</a></code> operator.  Assignment to <code class="inline"><span class="i">$!</span></code>
 is similarly ephemeral.
It can be used immediately before invoking the <code class="inline"><a class="l_k" href="functions/die.html">die()</a></code> operator,
to set the exit value, or to inspect the system error string
corresponding to error <i>n</i>, or to restore <code class="inline"><span class="i">$!</span></code>
 to a meaningful state.</p>
<p>Mnemonic: What just went bang?</p>
</li>
<li><a name="%25OS_ERROR"></a><b>%OS_ERROR</b>
</li>
<li><a name="%25ERRNO"></a><b>%ERRNO</b>
</li>
<li><a name="%25!"></a><b>%!
  </b>
<p>Each element of <code class="inline"><span class="i">%!</span></code>
 has a true value only if <code class="inline"><span class="i">$!</span></code>
 is set to that
value.  For example, <code class="inline"><span class="i">$!</span>{<span class="w">ENOENT</span>}</code>
 is true if and only if the current
value of <code class="inline"><span class="i">$!</span></code>
 is <code class="inline"><span class="w">ENOENT</span></code>
; that is, if the most recent error was "No
such file or directory" (or its moral equivalent: not all operating
systems give that exact error, and certainly not all languages).  The
specific true value is not guaranteed, but in the past has generally
been the numeric value of <code class="inline"><span class="i">$!</span></code>
.  To check if a particular key is
meaningful on your system, use <code class="inline"><a class="l_k" href="functions/exists.html">exists</a> <span class="i">$!</span>{<span class="w">the_key</span>}</code>
; for a list of legal
keys, use <code class="inline"><a class="l_k" href="functions/keys.html">keys</a> <span class="i">%!</span></code>
.  See <a href="Errno.html">Errno</a> for more information, and also see
<a href="#%24!">$!</a>.</p>
<p>This variable was added in Perl 5.005.</p>
</li>
<li><a name="%24CHILD_ERROR"></a><b>$CHILD_ERROR</b>
</li>
<li><a name="%24%3f"></a><b>$?
 </b>
<p>The status returned by the last pipe close, backtick (<code class="inline"><span class="q">``</span></code>
) command,
successful call to <code class="inline"><a class="l_k" href="functions/wait.html">wait()</a></code> or <code class="inline"><a class="l_k" href="functions/waitpid.html">waitpid()</a></code>, or from the <code class="inline"><a class="l_k" href="functions/system.html">system()</a></code>
operator.  This is just the 16-bit status word returned by the
traditional Unix <code class="inline"><a class="l_k" href="functions/wait.html">wait()</a></code> system call (or else is made up to look
like it).  Thus, the exit value of the subprocess is really (<code class="inline"><span class="i">$?</span>&gt;&gt;
<span class="n">8</span></code>
), and <code class="inline"><span class="i">$?</span> &amp; <span class="n">127</span></code>
 gives which signal, if any, the process died
from, and <code class="inline"><span class="i">$?</span> &amp; <span class="n">128</span></code>
 reports whether there was a core dump.</p>
<p>Additionally, if the <code class="inline"><span class="w">h_errno</span></code>
 variable is supported in C, its value
is returned via <code class="inline"><span class="i">$?</span></code>
 if any <code class="inline"><span class="w">gethost</span>*<span class="s">(</span><span class="s">)</span></code>
 function fails.</p>
<p>If you have installed a signal handler for <code class="inline"><span class="w">SIGCHLD</span></code>
, the
value of <code class="inline"><span class="i">$?</span></code>
 will usually be wrong outside that handler.</p>
<p>Inside an <code class="inline">END</code>
 subroutine <code class="inline"><span class="i">$?</span></code>
 contains the value that is going to be
given to <code class="inline"><a class="l_k" href="functions/exit.html">exit()</a></code>.  You can modify <code class="inline"><span class="i">$?</span></code>
 in an <code class="inline">END</code>
 subroutine to
change the exit status of your program.  For example:</p>
<pre class="verbatim"><ol><li>    END <span class="s">{</span></li><li>	<span class="i">$?</span> = <span class="n">1</span> if <span class="i">$?</span> == <span class="n">255</span><span class="sc">;</span>  <span class="c"># die would make it 255</span></li><li>    <span class="s">}</span></li></ol></pre><p>Under VMS, the pragma <code class="inline"><a class="l_k" href="functions/use.html">use</a> <span class="w">vmsish</span> <span class="q">&#39;status&#39;</span></code>
 makes <code class="inline"><span class="i">$?</span></code>
 reflect the
actual VMS exit status, instead of the default emulation of POSIX
status; see <a href="perlvms.html#%24%3f">$? in perlvms</a> for details.</p>
<p>Mnemonic: similar to <b>sh</b> and <b>ksh</b>.</p>
</li>
<li><a name="%24EVAL_ERROR"></a><b>$EVAL_ERROR</b>
</li>
<li><a name="%24%40"></a><b>$@
 </b>
<p>The Perl error from the last <code class="inline"><a class="l_k" href="functions/eval.html">eval</a></code> operator, i.e. the last exception that
was caught.  For <code class="inline"><a class="l_k" href="functions/eval.html">eval</a> <span class="w">BLOCK</span></code>
, this is either a runtime error message or the
string or reference <code class="inline"><a class="l_k" href="functions/die.html">die</a></code> was called with.  The <code class="inline"><a class="l_k" href="functions/eval.html">eval</a> <span class="w">STRING</span></code>
 form also
catches syntax errors and other compile time exceptions.</p>
<p>If no error occurs, <code class="inline"><a class="l_k" href="functions/eval.html">eval</a></code> sets <code class="inline"><span class="i">$@</span></code>
 to the empty string.</p>
<p>Warning messages are not collected in this variable.  You can, however,
set up a routine to process warnings by setting <code class="inline"><span class="i">$SIG</span>{<span class="w">__WARN__</span>}</code>
 as
described in <a href="#%25SIG">%SIG</a>.</p>
<p>Mnemonic: Where was the error "at"?</p>
</li>
</ul>
<a name="Variables-related-to-the-interpreter-state"></a><h2>Variables related to the interpreter state</h2>
<p>These variables provide information about the current interpreter state.</p>
<ul>
<li><a name="%24COMPILING"></a><b>$COMPILING</b>
</li>
<li><a name="%24%5eC"></a><b>$^C
 </b>
<p>The current value of the flag associated with the <b>-c</b> switch.
Mainly of use with <b>-MO=...</b> to allow code to alter its behavior
when being compiled, such as for example to <code class="inline">AUTOLOAD</code>
 at compile
time rather than normal, deferred loading.  Setting
<code class="inline"><span class="i">$^C</span> = <span class="n">1</span></code>
 is similar to calling <code class="inline"><span class="w">B::minus_c</span></code>
.</p>
<p>This variable was added in Perl v5.6.0.</p>
</li>
<li><a name="%24DEBUGGING"></a><b>$DEBUGGING</b>
</li>
<li><a name="%24%5eD"></a><b>$^D
 </b>
<p>The current value of the debugging flags.  May be read or set.  Like its
<a href="perlrun.html#-Dletters">command-line equivalent</a>, you can use numeric
or symbolic values, e.g. <code class="inline"><span class="i">$^D</span> = <span class="n">10</span></code>
 or <code class="inline"><span class="i">$^D</span> = <span class="q">&quot;st&quot;</span></code>
.  See
<a href="perlrun.html#-Dnumber">-Dnumber in perlrun</a>.  The contents of this variable also affects the
debugger operation.  See <a href="perldebguts.html#Debugger-Internals">Debugger Internals in perldebguts</a>.</p>
<p>Mnemonic: value of <b>-D</b> switch.</p>
</li>
<li><a name="%24%7b%5eENCODING%7d"></a><b>${^ENCODING}
</b>
<p>This variable is no longer supported.</p>
<p>It used to hold the <i>object reference</i> to the <code class="inline"><span class="w">Encode</span></code>
 object that was
used to convert the source code to Unicode.</p>
<p>Its purpose was to allow your non-ASCII Perl
scripts not to have to be written in UTF-8; this was
useful before editors that worked on UTF-8 encoded text were common, but
that was long ago.  It caused problems, such as affecting the operation
of other modules that weren't expecting it, causing general mayhem.</p>
<p>If you need something like this functionality, it is recommended that use
you a simple source filter, such as <a href="http://search.cpan.org/perldoc/Filter::Encoding">Filter::Encoding</a>.</p>
<p>If you are coming here because code of yours is being adversely affected
by someone's use of this variable, you can usually work around it by
doing this:</p>
<pre class="verbatim"><ol><li> <a class="l_k" href="functions/local.html">local</a> <span class="i">$</span>{<span class="w">^ENCODING</span>}<span class="sc">;</span></li></ol></pre><p>near the beginning of the functions that are getting broken.  This
undefines the variable during the scope of execution of the including
function.</p>
<p>This variable was added in Perl 5.8.2 and removed in 5.26.0.</p>
</li>
<li><a name="%24%7b%5eGLOBAL_PHASE%7d"></a><b>${^GLOBAL_PHASE}
</b>
<p>The current phase of the perl interpreter.</p>
<p>Possible values are:</p>
<ul>
<li><a name="CONSTRUCT"></a><b>CONSTRUCT</b>
<p>The <code class="inline"><span class="w">PerlInterpreter</span>*</code>
 is being constructed via <code class="inline"><span class="w">perl_construct</span></code>
.  This
value is mostly there for completeness and for use via the
underlying C variable <code class="inline"><span class="w">PL_phase</span></code>
.  It's not really possible for Perl
code to be executed unless construction of the interpreter is
finished.</p>
</li>
<li><a name="START"></a><b>START</b>
<p>This is the global compile-time.  That includes, basically, every
<code class="inline">BEGIN</code>
 block executed directly or indirectly from during the
compile-time of the top-level program.</p>
<p>This phase is not called "BEGIN" to avoid confusion with
<code class="inline">BEGIN</code>
-blocks, as those are executed during compile-time of any
compilation unit, not just the top-level program.  A new, localised
compile-time entered at run-time, for example by constructs as
<code class="inline"><a class="l_k" href="functions/eval.html">eval</a> <span class="q">&quot;use SomeModule&quot;</span></code>
 are not global interpreter phases, and
therefore aren't reflected by <code class="inline"><span class="i">$</span>{<span class="w">^GLOBAL_PHASE</span>}</code>
.</p>
</li>
<li><a name="CHECK"></a><b>CHECK</b>
<p>Execution of any <code class="inline">CHECK</code>
 blocks.</p>
</li>
<li><a name="INIT"></a><b>INIT</b>
<p>Similar to "CHECK", but for <code class="inline">INIT</code>
-blocks, not <code class="inline">CHECK</code>
 blocks.</p>
</li>
<li><a name="RUN"></a><b>RUN</b>
<p>The main run-time, i.e. the execution of <code class="inline"><span class="w">PL_main_root</span></code>
.</p>
</li>
<li><a name="END"></a><b>END</b>
<p>Execution of any <code class="inline">END</code>
 blocks.</p>
</li>
<li><a name="DESTRUCT"></a><b>DESTRUCT</b>
<p>Global destruction.</p>
</li>
</ul>
<p>Also note that there's no value for UNITCHECK-blocks.  That's because
those are run for each compilation unit individually, and therefore is
not a global interpreter phase.</p>
<p>Not every program has to go through each of the possible phases, but
transition from one phase to another can only happen in the order
described in the above list.</p>
<p>An example of all of the phases Perl code can see:</p>
<pre class="verbatim"><ol><li>    BEGIN <span class="s">{</span> <a class="l_k" href="functions/print.html">print</a> <span class="q">&quot;compile-time: ${^GLOBAL_PHASE}\n&quot;</span> <span class="s">}</span></li><li></li><li>    INIT  <span class="s">{</span> <a class="l_k" href="functions/print.html">print</a> <span class="q">&quot;init-time: ${^GLOBAL_PHASE}\n&quot;</span> <span class="s">}</span></li><li></li><li>    CHECK <span class="s">{</span> <a class="l_k" href="functions/print.html">print</a> <span class="q">&quot;check-time: ${^GLOBAL_PHASE}\n&quot;</span> <span class="s">}</span></li><li></li><li>    <span class="s">{</span></li><li><a name="package-Print::Phase"></a>        package <span class="i">Print::Phase</span><span class="sc">;</span></li><li></li><li><a name="new"></a>        sub <span class="m">new</span> <span class="s">{</span></li><li>            <a class="l_k" href="functions/my.html">my</a> <span class="s">(</span><span class="i">$class</span><span class="cm">,</span> <span class="i">$time</span><span class="s">)</span> = <span class="i">@_</span><span class="sc">;</span></li><li>            <a class="l_k" href="functions/return.html">return</a> <a class="l_k" href="functions/bless.html">bless</a> \<span class="i">$time</span><span class="cm">,</span> <span class="i">$class</span><span class="sc">;</span></li><li>        <span class="s">}</span></li><li></li><li><a name="DESTROY"></a>        sub <span class="m">DESTROY</span> <span class="s">{</span></li><li>            <a class="l_k" href="functions/my.html">my</a> <span class="i">$self</span> = <a class="l_k" href="functions/shift.html">shift</a><span class="sc">;</span></li><li>            <a class="l_k" href="functions/print.html">print</a> <span class="q">&quot;$$self: ${^GLOBAL_PHASE}\n&quot;</span><span class="sc">;</span></li><li>        <span class="s">}</span></li><li><a name="package-main"></a>    <span class="s">}</span></li><li></li><li>    <a class="l_k" href="functions/print.html">print</a> <span class="q">&quot;run-time: ${^GLOBAL_PHASE}\n&quot;</span><span class="sc">;</span></li><li></li><li>    <a class="l_k" href="functions/my.html">my</a> <span class="i">$runtime</span> = <span class="w">Print::Phase</span><span class="w">-&gt;new</span><span class="s">(</span></li><li>        <span class="q">&quot;lexical variables are garbage collected before END&quot;</span></li><li>    <span class="s">)</span><span class="sc">;</span></li><li></li><li>    END   <span class="s">{</span> <a class="l_k" href="functions/print.html">print</a> <span class="q">&quot;end-time: ${^GLOBAL_PHASE}\n&quot;</span> <span class="s">}</span></li><li></li><li>    <a class="l_k" href="functions/our.html">our</a> <span class="i">$destruct</span> = <span class="w">Print::Phase</span><span class="w">-&gt;new</span><span class="s">(</span></li><li>        <span class="q">&quot;package variables are garbage collected after END&quot;</span></li><li>    <span class="s">)</span><span class="sc">;</span></li></ol></pre><p>This will print out</p>
<pre class="verbatim"><ol><li>    <span class="w">compile</span>-<a class="l_k" href="functions/time.html">time</a><span class="co">:</span> <span class="w">START</span></li><li>    <span class="w">check</span>-<a class="l_k" href="functions/time.html">time</a><span class="co">:</span> CHECK</li><li>    <span class="w">init</span>-<a class="l_k" href="functions/time.html">time</a><span class="co">:</span> INIT</li><li>    <span class="w">run</span>-<a class="l_k" href="functions/time.html">time</a><span class="co">:</span> <span class="w">RUN</span></li><li>    <span class="w">lexical</span> <span class="w">variables</span> <span class="w">are</span> <span class="w">garbage</span> <span class="w">collected</span> <span class="w">before</span> END<span class="co">:</span> <span class="w">RUN</span></li><li>    <span class="w">end</span>-<a class="l_k" href="functions/time.html">time</a><span class="co">:</span> END</li><li><a name="package-variables"></a>    package <span class="i">variables</span> <span class="w">are</span> <span class="w">garbage</span> <span class="w">collected</span> <span class="w">after</span> END<span class="co">:</span> <span class="w">DESTRUCT</span></li></ol></pre><p>This variable was added in Perl 5.14.0.</p>
</li>
<li><a name="%24%5eH"></a><b>$^H
</b>
<p>WARNING: This variable is strictly for
internal use only.  Its availability,
behavior, and contents are subject to change without notice.</p>
<p>This variable contains compile-time hints for the Perl interpreter.  At the
end of compilation of a BLOCK the value of this variable is restored to the
value when the interpreter started to compile the BLOCK.</p>
<p>When perl begins to parse any block construct that provides a lexical scope
(e.g., eval body, required file, subroutine body, loop body, or conditional
block), the existing value of <code class="inline"><span class="i">$^H</span></code>
 is saved, but its value is left unchanged.
When the compilation of the block is completed, it regains the saved value.
Between the points where its value is saved and restored, code that
executes within BEGIN blocks is free to change the value of <code class="inline"><span class="i">$^H</span></code>
.</p>
<p>This behavior provides the semantic of lexical scoping, and is used in,
for instance, the <code class="inline"><a class="l_k" href="functions/use.html">use</a> <span class="w">strict</span></code>
 pragma.</p>
<p>The contents should be an integer; different bits of it are used for
different pragmatic flags.  Here's an example:</p>
<pre class="verbatim"><ol><li><a name="add_100"></a>    sub <span class="m">add_100</span> <span class="s">{</span> <span class="i">$^H</span> |= <span class="n">0x100</span> <span class="s">}</span></li><li></li><li><a name="foo"></a>    sub <span class="m">foo</span> <span class="s">{</span></li><li>	BEGIN <span class="s">{</span> <span class="i">add_100</span><span class="s">(</span><span class="s">)</span> <span class="s">}</span></li><li>	<span class="w">bar</span><span class="w">-&gt;baz</span><span class="s">(</span><span class="i">$boon</span><span class="s">)</span><span class="sc">;</span></li><li>    <span class="s">}</span></li></ol></pre><p>Consider what happens during execution of the BEGIN block.  At this point
the BEGIN block has already been compiled, but the body of <code class="inline"><span class="i">foo</span><span class="s">(</span><span class="s">)</span></code>
 is still
being compiled.  The new value of <code class="inline"><span class="i">$^H</span></code>

will therefore be visible only while
the body of <code class="inline"><span class="i">foo</span><span class="s">(</span><span class="s">)</span></code>
 is being compiled.</p>
<p>Substitution of <code class="inline">BEGIN <span class="s">{</span> <span class="i">add_100</span><span class="s">(</span><span class="s">)</span> <span class="s">}</span></code>
 block with:</p>
<pre class="verbatim"><ol><li>    BEGIN <span class="s">{</span> <a class="l_k" href="functions/require.html">require</a> <span class="w">strict</span><span class="sc">;</span> <span class="w">strict</span><span class="w">-&gt;import</span><span class="s">(</span><span class="q">&#39;vars&#39;</span><span class="s">)</span> <span class="s">}</span></li></ol></pre><p>demonstrates how <code class="inline"><a class="l_k" href="functions/use.html">use</a> <span class="w">strict</span> <span class="q">&#39;vars&#39;</span></code>
 is implemented.  Here's a conditional
version of the same lexical pragma:</p>
<pre class="verbatim"><ol><li>    <a class="l_k" href="functions/BEGIN.html">BEGIN</a> <span class="s">{</span></li><li>	<a class="l_k" href="functions/require.html">require</a> <span class="w">strict</span><span class="sc">;</span> <span class="w">strict</span><span class="w">-&gt;import</span><span class="s">(</span><span class="q">&#39;vars&#39;</span><span class="s">)</span> <a class="l_k" href="functions/if.html">if</a> <span class="i">$condition</span></li><li>    <span class="s">}</span></li></ol></pre><p>This variable was added in Perl 5.003.</p>
</li>
<li><a name="%25%5eH"></a><b>%^H
</b>
<p>The <code class="inline"><span class="i">%^H</span></code>
 hash provides the same scoping semantic as <code class="inline"><span class="i">$^H</span></code>
.  This makes
it useful for implementation of lexically scoped pragmas.  See
<a href="perlpragma.html">perlpragma</a>.   All the entries are stringified when accessed at
runtime, so only simple values can be accommodated.  This means no
pointers to objects, for example.</p>
<p>When putting items into <code class="inline"><span class="i">%^H</span></code>
, in order to avoid conflicting with other
users of the hash there is a convention regarding which keys to use.
A module should use only keys that begin with the module's name (the
name of its main package) and a "/" character.  For example, a module
<code class="inline"><span class="w">Foo::Bar</span></code>
 should use keys such as <code class="inline"><span class="w">Foo::Bar</span>/<span class="w">baz</span></code>
.</p>
<p>This variable was added in Perl v5.6.0.</p>
</li>
<li><a name="%24%7b%5eOPEN%7d"></a><b>${^OPEN}
</b>
<p>An internal variable used by PerlIO.  A string in two parts, separated
by a <code class="inline">\<span class="n">0</span></code>
 byte, the first part describes the input layers, the second
part describes the output layers.</p>
<p>This variable was added in Perl v5.8.0.</p>
</li>
<li><a name="%24PERLDB"></a><b>$PERLDB</b>
</li>
<li><a name="%24%5eP"></a><b>$^P
 </b>
<p>The internal variable for debugging support.  The meanings of the
various bits are subject to change, but currently indicate:</p>
<dl>
<dt>0</dt><dd><a name="0x01"></a><b>x01</b>
<p>Debug subroutine enter/exit.</p>
</dd>
<dt>0</dt><dd><a name="0x02"></a><b>x02</b>
<p>Line-by-line debugging.  Causes <code class="inline"><span class="i">DB::DB</span><span class="s">(</span><span class="s">)</span></code>
 subroutine to be called for
each statement executed.  Also causes saving source code lines (like
0x400).</p>
</dd>
<dt>0</dt><dd><a name="0x04"></a><b>x04</b>
<p>Switch off optimizations.</p>
</dd>
<dt>0</dt><dd><a name="0x08"></a><b>x08</b>
<p>Preserve more data for future interactive inspections.</p>
</dd>
<dt>0</dt><dd><a name="0x10"></a><b>x10</b>
<p>Keep info about source lines on which a subroutine is defined.</p>
</dd>
<dt>0</dt><dd><a name="0x20"></a><b>x20</b>
<p>Start with single-step on.</p>
</dd>
<dt>0</dt><dd><a name="0x40"></a><b>x40</b>
<p>Use subroutine address instead of name when reporting.</p>
</dd>
<dt>0</dt><dd><a name="0x80"></a><b>x80</b>
<p>Report <code class="inline"><a class="l_k" href="functions/goto.html">goto</a> <span class="i">&amp;subroutine</span></code>
 as well.</p>
</dd>
<dt>0</dt><dd><a name="0x100"></a><b>x100</b>
<p>Provide informative "file" names for evals based on the place they were compiled.</p>
</dd>
<dt>0</dt><dd><a name="0x200"></a><b>x200</b>
<p>Provide informative names to anonymous subroutines based on the place they
were compiled.</p>
</dd>
<dt>0</dt><dd><a name="0x400"></a><b>x400</b>
<p>Save source code lines into <code class="inline"><span class="i">@</span>{<span class="q">&quot;_&lt;$filename&quot;</span>}</code>
.</p>
</dd>
<dt>0</dt><dd><a name="0x800"></a><b>x800</b>
<p>When saving source, include evals that generate no subroutines.</p>
</dd>
<dt>0</dt><dd><a name="0x1000"></a><b>x1000</b>
<p>When saving source, include source that did not compile.</p>
</dd>
</dl>
<p>Some bits may be relevant at compile-time only, some at
run-time only.  This is a new mechanism and the details may change.
See also <a href="perldebguts.html">perldebguts</a>.</p>
</li>
<li><a name="%24%7b%5eTAINT%7d"></a><b>${^TAINT}
</b>
<p>Reflects if taint mode is on or off.  1 for on (the program was run with
<b>-T</b>), 0 for off, -1 when only taint warnings are enabled (i.e. with
<b>-t</b> or <b>-TU</b>).</p>
<p>This variable is read-only.</p>
<p>This variable was added in Perl v5.8.0.</p>
</li>
<li><a name="%24%7b%5eUNICODE%7d"></a><b>${^UNICODE}
</b>
<p>Reflects certain Unicode settings of Perl.  See <a href="perlrun.html">perlrun</a>
documentation for the <code class="inline">-C</code>
 switch for more information about
the possible values.</p>
<p>This variable is set during Perl startup and is thereafter read-only.</p>
<p>This variable was added in Perl v5.8.2.</p>
</li>
<li><a name="%24%7b%5eUTF8CACHE%7d"></a><b>${^UTF8CACHE}
</b>
<p>This variable controls the state of the internal UTF-8 offset caching code.
1 for on (the default), 0 for off, -1 to debug the caching code by checking
all its results against linear scans, and panicking on any discrepancy.</p>
<p>This variable was added in Perl v5.8.9.  It is subject to change or
removal without notice, but is currently used to avoid recalculating the
boundaries of multi-byte UTF-8-encoded characters.</p>
</li>
<li><a name="%24%7b%5eUTF8LOCALE%7d"></a><b>${^UTF8LOCALE}
</b>
<p>This variable indicates whether a UTF-8 locale was detected by perl at
startup.  This information is used by perl when it's in
adjust-utf8ness-to-locale mode (as when run with the <code class="inline">-<span class="w">CL</span></code>
 command-line
switch); see <a href="perlrun.html">perlrun</a> for more info on this.</p>
<p>This variable was added in Perl v5.8.8.</p>
</li>
</ul>
<a name="Deprecated-and-removed-variables"></a><h2>Deprecated and removed variables</h2>
<p>Deprecating a variable announces the intent of the perl maintainers to
eventually remove the variable from the language.  It may still be
available despite its status.  Using a deprecated variable triggers
a warning.</p>
<p>Once a variable is removed, its use triggers an error telling you
the variable is unsupported.</p>
<p>See <a href="perldiag.html">perldiag</a> for details about error messages.</p>
<ul>
<li><a name="%24%23"></a><b>$#
</b>
<p><code class="inline"><span class="i">$#</span></code>
 was a variable that could be used to format printed numbers.
After a deprecation cycle, its magic was removed in Perl v5.10.0 and
using it now triggers a warning: <code class="inline">$# is no longer supported</code>.</p>
<p>This is not the sigil you use in front of an array name to get the
last index, like <code class="inline"><span class="i">$#array</span></code>
.  That's still how you get the last index
of an array in Perl.  The two have nothing to do with each other.</p>
<p>Deprecated in Perl 5.</p>
<p>Removed in Perl v5.10.0.</p>
</li>
<li><a name="%24*"></a><b>$*
</b>
<p><code class="inline"><span class="i">$*</span></code>
 was a variable that you could use to enable multiline matching.
After a deprecation cycle, its magic was removed in Perl v5.10.0.
Using it now triggers a warning: <code class="inline">$* is no longer supported</code>.
You should use the <code class="inline">/s</code> and <code class="inline">/m</code> regexp modifiers instead.</p>
<p>Deprecated in Perl 5.</p>
<p>Removed in Perl v5.10.0.</p>
</li>
<li><a name="%24%5b"></a><b>$[
</b>
<p>This variable stores the index of the first element in an array, and
of the first character in a substring.  The default is 0, but you could
theoretically set it to 1 to make Perl behave more like <b>awk</b> (or Fortran)
when subscripting and when evaluating the index() and substr() functions.</p>
<p>As of release 5 of Perl, assignment to <code class="inline"><span class="i">$[</span></code>
 is treated as a compiler
directive, and cannot influence the behavior of any other file.
(That's why you can only assign compile-time constants to it.)
Its use is highly discouraged.</p>
<p>Prior to Perl v5.10.0, assignment to <code class="inline"><span class="i">$[</span></code>
 could be seen from outer lexical
scopes in the same file, unlike other compile-time directives (such as
<a href="strict.html">strict</a>).  Using local() on it would bind its value strictly to a lexical
block.  Now it is always lexically scoped.</p>
<p>As of Perl v5.16.0, it is implemented by the <a href="arybase.html">arybase</a> module.  See
<a href="arybase.html">arybase</a> for more details on its behaviour.</p>
<p>Under <code class="inline"><a class="l_k" href="functions/use.html">use</a> <span class="v">v5.16</span></code>
, or <code class="inline"><a class="l_k" href="functions/no.html">no</a> <span class="w">feature</span> <span class="q">&quot;array_base&quot;</span></code>
, <code class="inline"><span class="i">$[</span></code>
 no longer has any
effect, and always contains 0.  Assigning 0 to it is permitted, but any
other value will produce an error.</p>
<p>Mnemonic: [ begins subscripts.</p>
<p>Deprecated in Perl v5.12.0.</p>
</li>
</ul>




  <div id="page_index" class="hud_container">
    <div id="page_index_header" class="hud_header">
      <div id="page_index_close" class="hud_close"><a href="#" onClick="pageIndex.hide();return false;"></a></div>
      <div id="page_index_title" class="hud_title"><span class="hud_span_top">Page index</span></div>
      <div id="page_index_topright" class="hud_topright"></div>
    </div>
    <div id="page_index_content" class="hud_content">
      <ul><li><a href="#NAME">NAME</a><li><a href="#DESCRIPTION">DESCRIPTION</a><ul><li><a href="#The-Syntax-of-Variable-Names">The Syntax of Variable Names</a></ul><li><a href="#SPECIAL-VARIABLES">SPECIAL VARIABLES</a><ul><li><a href="#General-Variables">General Variables</a><li><a href="#Variables-related-to-regular-expressions">Variables related to regular expressions</a><li><a href="#Variables-related-to-filehandles">Variables related to filehandles</a><li><a href="#Error-Variables">Error Variables
 </a><li><a href="#Variables-related-to-the-interpreter-state">Variables related to the interpreter state</a><li><a href="#Deprecated-and-removed-variables">Deprecated and removed variables</a></ul></ul>
    </div>
    <div id="page_index_footer" class="hud_footer">
      <div id="page_index_bottomleft" class="hud_bottomleft"></div>
      <div id="page_index_bottom" class="hud_bottom"><span class="hud_span_bottom"></span></div>
      <div id="page_index_resize" class="hud_resize"></div>
    </div>
  </div>


	    &nbsp;
          </div>
          <div id="content_footer">
          </div>
        </div>
        <div class="clear"></div>
      </div>
      
    <div id="footer">
      <div id="footer_content">
        <div id="footer_strapline">
          perldoc.perl.org - Official documentation for the Perl programming language
        </div>
        <div id="footer_links">
          <div id="address">
            <p class="name">Contact details</p>
            <p class="address">
	      Site maintained by <a href="mailto:jj@jonallen.info">Jon Allen (JJ)</a><br>
	    </p>
            <p class="contact">
              Documentation maintained by the <a href="http://lists.cpan.org/showlist.cgi?name=perl5-porters">Perl 5 Porters</a>
            </p>
          </div>
          <ul class="f1">
            <li>Manual
              <ul class="f2">
                <li><a href="index-overview.html">Overview</a>
                <li><a href="index-tutorials.html">Tutorials</a>
                <li><a href="index-faq.html">FAQs</a>
                <li><a href="index-history.html">Changes</a>
              </ul>
            <li>Reference
              <ul class="f2">
                <li><a href="index-language.html">Language</a>
                <li><a href="index-functions.html">Functions</a>
                <li><a href="perlop.html">Operators</a>
                <li><a href="perlvar.html">Variables</a>
              </ul>
            <li>Modules
              <ul class="f2">
                <li><a href="index-modules-A.html">Modules</a>
                <li><a href="index-pragmas.html">Pragmas</a>
                <li><a href="index-utilities.html">Utilities</a>
              </ul>
            <li>Misc
              <ul class="f2">
                <li><a href="index-licence.html">License</a>
                <li><a href="index-internals.html">Internals</a>
                <li><a href="index-platforms.html">Platforms</a>
              </ul>          </ul>
          <div class="clear"></div>
        </div>
      </div>
      <div id="footer_end">
      </div>
    </div>
      
    </div>
      <script language="JavaScript" type="text/javascript" src="static/exploreperl.js"></script>
      <script language="JavaScript" src="static/combined-20100403.js" type="text/javascript"></script>
<script language="JavaScript" type="text/javascript">
  perldoc.setPath(0);
  perldoc.pageName    = 'perlvar';
  perldoc.pageAddress = 'perlvar.html';
  perldoc.contentPage = 1;
  explorePerl.render();
  explorePerl.addEvents('explore_anchor');
</script>
    
  </body>
</html>