File: perlvar.html

package info (click to toggle)
perl-doc-html 5.10.1-1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 33,152 kB
  • ctags: 24,035
  • sloc: makefile: 10
file content (2000 lines) | stat: -rw-r--r-- 118,946 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
<!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 href="static/css-20090810.css" rel="stylesheet" rev="stylesheet" type="text/css" media="screen">
</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="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="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>
                <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>
          <div class="side_group">
            <div class="side_panel links_panel">
              <p>News / Blogs</p>
              <ul>
        <li><a href="http://perlbuzz.com">Perl Buzz</a></li>
        <li><a href="http://ironman.enlightenedperl.org">Perl Iron Man</a></li>
        <li><a href="http://perlsphere.net">Perlsphere</a></li>
        <li><a href="http://planet.perl.org">Planet Perl</a></li>
	<li><a href="http://news.perlfoundation.org/">TPF news</a></li>
        <li><a href="http://use.perl.org">Use Perl</a></li>
              </ul>
            </div>            
            <div class="side_panel links_panel">
              <p>See also</p>
              <ul>
        <li><a href="http://search.cpan.org">CPAN</a></li>
        <li><a href="http://www.perl.org">Perl.org</a></li>
        <li><a href="http://www.perl.com">Perl.com</a></li>
        <li><a href="http://www.perlfoundation.org/perl5/index.cgi">Perl 5 Wiki</a></li>
        <li><a href="http://jobs.perl.org">Perl Jobs</a></li>
        <li><a href="http://www.pm.org">Perl Mongers</a></li>
        <li><a href="http://www.perlmonks.org">Perl Monks</a></li>
              </ul>
            </div>
            <div class="side_panel links_panel">
              <p>Contact</p>
              <ul>
                <li><a href="http://perl.jonallen.info">Site designed and maintained by Jon&nbsp;Allen&nbsp;(JJ)</a>
                <li><a href="http://perl.jonallen.info">http://perl.jonallen.info</a>
              </ul>
              <ul>
                <li><a href="http://perl.jonallen.info/projects/perldoc">View the project page and FAQs</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 10.1 documentation
              </div>
              <div id="page_links">
                <a href="#" onClick="toolbar.goToTop();return false;">Go to top</a>
		
                  &bull; <a href="#" id="page_index_toggle">Show page index</a>
		
		
              </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="from_search"></div>
            <h1>perlvar</h1>


  <!--    -->
<ul><li><a href="#NAME">NAME</a><li><a href="#DESCRIPTION">DESCRIPTION</a><ul><li><a href="#Predefined-Names">Predefined Names</a><li><a href="#Error-Indicators">Error Indicators
 </a><li><a href="#Technical-Note-on-the-Syntax-of-Variable-Names">Technical Note on the Syntax of Variable Names</a></ul><li><a href="#BUGS">BUGS</a></ul><a name="NAME"></a><h1>NAME</h1>
<p>perlvar - Perl predefined variables</p>
<a name="DESCRIPTION"></a><h1>DESCRIPTION</h1>
<a name="Predefined-Names"></a><h2>Predefined Names</h2>
<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>. In general, it&#39;s best to use the</p>
<pre class="verbatim"><ol><li>    <a class="l_k" href="functions/use.html">use</a> <span class="w">English</span> <span class="q">&#39;-no_match_vars&#39;</span><span class="sc">;</span></li></ol></pre><p>invocation if you don&#39;t need $PREMATCH, $MATCH, or $POSTMATCH, as it avoids
a certain performance hit with the use of regular expressions. See
<a href="English.html">English</a>.</p>
<p>Variables that depend on the currently selected filehandle may be set by
calling an appropriate object method on the IO::Handle 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 IO::Handle attribute.
The methods each take an optional EXPR, which, if supplied, specifies the
new value for the IO::Handle attribute in question.  If not supplied,
most methods do nothing to the current value--except for
autoflush(), which will assume a 1 for you, just to be different.</p>
<p>Because loading in the IO::Handle 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 &quot;read-only&quot;.  This means that if
you try to assign to this variable, either directly or indirectly through
a reference, you&#39;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&#39;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 &quot;line mode&quot;, 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">''</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> or <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>    for <span class="s">(</span><span class="n">1</span>..<span class="n">5</span><span class="s">)</span><span class="s">{</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><a name="nasty_break"></a>    sub <span class="m">nasty_break</span> <span class="s">{</span></li><li>        <span class="i">$_</span> = <span class="n">5</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:</p>
<pre class="verbatim"><ol><li>    1 2 3 4 5</li></ol></pre><p>but instead you get:</p>
<pre class="verbatim"><ol><li>    5 5 5 5 5</li></ol></pre><p>Why? Because nasty_break() modifies <code class="inline"><span class="i">$_</span></code>
 without localizing it
first. The fix is to add local():</p>
<pre class="verbatim"><ol><li>        <a class="l_k" href="functions/local.html">local</a> <span class="i">$_</span> = <span class="n">5</span><span class="sc">;</span></li></ol></pre><p>It&#39;s easy to notice the problem in such a short example, but in more
complicated code you are looking for trouble if you don&#39;t localize
changes to the special variables.</p>
<p>The following list is ordered by scalar variables first, then the
arrays, then the hashes.</p>
<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>    while (&lt;&gt;) {...}	# equivalent only in while!</li><li>    while (defined($_ = &lt;&gt;)) {...}</li><li></li><li>    /^Subject:/</li><li>    $_ =~ /^Subject:/</li><li></li><li>    tr/a-z/A-Z/</li><li>    $_ =~ tr/a-z/A-Z/</li><li></li><li>    chomp</li><li>    chomp($_)</li></ol></pre><p>Here are the places where Perl will assume $_ even if you
don&#39;t use it:</p>
<ul>
<li>
<p>The following functions:</p>
<p>abs, alarm, chomp, chop, chr, chroot, cos, defined, eval, exp, glob,
hex, int, lc, lcfirst, length, log, lstat, mkdir, oct, ord, pos, print,
quotemeta, readlink, readpipe, ref, require, reverse (in scalar context only),
rmdir, sin, split (on 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 grep() and map() functions.</p>
</li>
<li>
<p>The implicit variable of given().</p>
</li>
<li>
<p>The default place to put an input record when a <code class="inline"><span class="q">&lt;FH&gt;</span></code>

operation&#39;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>As <code class="inline"><span class="i">$_</span></code>
 is a global variable, this may lead in some cases to unwanted
side-effects.  As of perl 5.9.1, you can now 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.</p>
<p>(Mnemonic: underline is understood in certain operations.)</p>
</li>
</ul>
<ul>
<li><a name="%24a"></a><b>$a</b>
</li>
<li><a name="%24b"></a><b>$b
 </b>
<p>Special package variables when using sort(), see <a href="functions/sort.html">sort</a>.
Because of this specialness $a and $b don&#39;t need to be declared
(using use vars, or our()) even when using the <code class="inline"><span class="w">strict</span> <span class="q">&#39;vars&#39;</span></code>
 pragma.
Don&#39;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 sort() comparison block or function.</p>
</li>
</ul>
<ul>
<li><a name="%24%3c_digits_%3e"></a><b>$&lt;<i>digits</i>&gt;
  </b>
<p>Contains the subpattern from the corresponding set of capturing
parentheses from the last pattern match, not counting patterns
matched in nested blocks that have been exited already.  (Mnemonic:
like \digits.)  These variables are all read-only and dynamically
scoped to the current BLOCK.</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 eval() enclosed by the current
BLOCK).  (Mnemonic: like &amp; in some editors.)  This variable is read-only
and dynamically scoped to the current BLOCK.</p>
<p>The use of this variable anywhere in a program imposes a considerable
performance penalty on all regular expression matches.  See <a href="#BUGS">"BUGS"</a>.</p>
<p>See <a href="#%40-">"@-"</a> for a replacement.</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, and is only guaranteed
to return a defined value when the pattern was compiled or executed with
the <code class="inline">/p</code> modifier.</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 eval
enclosed by the current BLOCK).  (Mnemonic: <code class="inline">`</code> often precedes a quoted
string.)  This variable is read-only.</p>
<p>The use of this variable anywhere in a program imposes a considerable
performance penalty on all regular expression matches.  See <a href="#BUGS">"BUGS"</a>.</p>
<p>See <a href="#%40-">"@-"</a> for a replacement.</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, and is only guaranteed
to return a defined value when the pattern was compiled or executed with
the <code class="inline">/p</code> modifier.</p>
</li>
<li><a name="%24POSTMATCH"></a><b>$POSTMATCH</b>
</li>
<li><a name="%24'"></a><b>$&#39;
 </b>
<p>The string following whatever was matched by the last successful
pattern match (not counting any matches hidden within a BLOCK or eval()
enclosed by the current BLOCK).  (Mnemonic: <code class="inline">'</code> often follows a quoted
string.)  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>This variable is read-only and dynamically scoped to the current BLOCK.</p>
<p>The use of this variable anywhere in a program imposes a considerable
performance penalty on all regular expression matches.  See <a href="#BUGS">"BUGS"</a>.</p>
<p>See <a href="#%40-">"@-"</a> for a replacement.</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, and is only guaranteed
to return a defined value when the pattern was compiled or executed with
the <code class="inline">/p</code> modifier.</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&#39;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>(Mnemonic: be positive and forward looking.)
This variable is read-only and dynamically scoped to the current BLOCK.</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.  (Mnemonic: the (possibly) Nested parenthesis that most
recently closed.)</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>     (?:(...)(?{ $var = $^N }))</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 is dynamically scoped to the current BLOCK.</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 $1 ends, <code class="inline"><span class="i">$+</span>[<span class="n">2</span>]</code>
 the offset
past where $2 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>
</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">'foo'</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>
</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&#39;s idea of what
constitutes a line may not match yours.)  When a line is read from a
filehandle (via readline() or <code class="inline">&lt;&gt;</code>
), or when tell() or seek() 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&#39;s line count</i>.  Instead, it will localize perl&#39;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 close().  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 ARGV 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 &quot;.&quot; 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&#39;s idea of what a &quot;line&quot; is.  Works like <b>awk</b>&#39;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&#39;s a newline.  (Mnemonic: / delimits
line boundaries when quoting poetry.)</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&#39;s convertible to an integer will attempt to read records
instead of lines, with the maximum record size being the referenced
integer.  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 bytes from FILE.  If you&#39;re
not reading from a record-oriented file (or your OS doesn&#39;t have
record-oriented files), then you&#39;ll likely get a full chunk of data
with every read.  If a record is larger than the record size you&#39;ve
set, you&#39;ll get the record back in pieces.  Trying to set the record
size to zero or less will cause reading in the (rest of the) whole file.</p>
<p>On VMS, record reads are done with the equivalent of <code class="inline"><a class="l_k" href="functions/sysread.html">sysread</a></code>,
so it&#39;s best not to mix record and non-record reads on the same
file.  (This is unlikely to be a problem, because any file you&#39;d
want to read in record mode is probably unusable in line mode.)
Non-VMS systems do normal I/O, so it&#39;s safe to mix record and
non-record reads of a file.</p>
<p>See also <a href="perlport.html#Newlines">"Newlines" in perlport</a>.  Also see <code class="inline"><span class="i">$.</span></code>
.</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&#39;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&#39;s
happening.  This has no effect on input buffering.  See <a href="functions/getc.html">getc</a>
for that.  See <a href="perldoc.html#select">"select" in perldoc</a> on how to select the output channel. 
See also <a href="IO/Handle.html">IO::Handle</a>. (Mnemonic: when you want your pipes to be piping hot.)</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&#39;s arguments.  Default is <code class="inline"><a class="l_k" href="functions/undef.html">undef</a></code>.
(Mnemonic: what is printed when there is a &quot;,&quot; in your print statement.)</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&#39;s arguments.  Default is <code class="inline"><a class="l_k" href="functions/undef.html">undef</a></code>.
(Mnemonic: you set <code class="inline"><span class="i">$\</span></code>
 instead of adding &quot;\n&quot; at the end of the print.
Also, it&#39;s just like <code class="inline"><span class="i">$/</span></code>
, but it&#39;s what you get &quot;back&quot; from Perl.)</p>
</li>
<li><a name="%24LIST_SEPARATOR"></a><b>$LIST_SEPARATOR</b>
</li>
<li><a name="%24%22"></a><b>$&quot;
 </b>
<p>This is like <code class="inline"><span class="i">$,</span></code>
 except that it applies to array and slice values
interpolated into a double-quoted string (or similar interpreted
string).  Default is a space.  (Mnemonic: obvious, I think.)</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">$a</span><span class="cm">,</span><span class="i">$b</span><span class="cm">,</span><span class="i">$c</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">$a</span><span class="cm">,</span> <span class="i">$b</span><span class="cm">,</span> <span class="i">$c</span><span class="s">)</span>}</li></ol></pre><p>But don&#39;t put</p>
<pre class="verbatim"><ol><li>    <span class="i">@foo</span>{<span class="i">$a</span><span class="cm">,</span><span class="i">$b</span><span class="cm">,</span><span class="i">$c</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">$a</span>}<span class="cm">,</span><span class="i">$foo</span>{<span class="i">$b</span>}<span class="cm">,</span><span class="i">$foo</span>{<span class="i">$c</span>}<span class="s">)</span></li></ol></pre><p>Default is &quot;\034&quot;, 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>
.
(Mnemonic: comma (the syntactic subscript separator) is a
semi-semicolon.  Yeah, I know, it&#39;s pretty lame, but <code class="inline"><span class="i">$,</span></code>
 is already
taken for something more important.)</p>
<p>Consider using &quot;real&quot; multidimensional arrays as described
in <a href="perllol.html">perllol</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.
Used with formats.
(Mnemonic: % is page number in <b>nroff</b>.)</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.  Default is 60.  
Used with formats.
(Mnemonic: = has horizontal lines.)</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.  
Used with formats.
(Mnemonic: lines_on_page - lines_printed.)</p>
</li>
<li><a name="%40LAST_MATCH_START"></a><b>@LAST_MATCH_START</b>
</li>
<li><a name="%40-"></a><b>@-
 </b>
<p>$-[0] 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 $_, $&amp; 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 $1
begins, <code class="inline"><span class="i">$-</span>[<span class="n">2</span>]</code>
 the offset where $2 begins, and so on.</p>
<p>After a match against some variable $var:</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>
</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 buffers
in the last successful match in the currently active dynamic scope. To
each capture buffer 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&#39;s an example:</p>
<pre class="verbatim"><ol><li>    if <span class="s">(</span><span class="q">'1234'</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>        foreach <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>            foreach <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> ? <span class="q">&quot;'$ary-&gt;[$idx]'&quot;</span> <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>
</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.  Default is the name of the filehandle.  (Mnemonic: brother to
<code class="inline"><span class="i">$^</span></code>
.)</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.  Default is the name of the filehandle with _TOP
appended.  (Mnemonic: points to top of page.)</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 ^) in a format.  Default is
&quot; \n-&quot;, to break on whitespace or hyphens.  (Mnemonic: a &quot;colon&quot; in
poetry is a part of a line.)</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.  Default is \f.</p>
</li>
<li><a name="%24ACCUMULATOR"></a><b>$ACCUMULATOR</b>
</li>
<li><a name="%24%5eA"></a><b>$^A
 </b>
<p>The current value of the write() accumulator for format() lines.  A format
contains formline() calls that put their result into <code class="inline"><span class="i">$^A</span></code>
.  After
calling its format, write() 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
formline() yourself and then look at it.  See <a href="perlform.html">perlform</a> and
<a href="functions/formline.html">formline()</a>.</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 wait() or waitpid(), or from the system()
operator.  This is just the 16-bit status word returned by the
traditional Unix wait() 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.  (Mnemonic:
similar to <b>sh</b> and <b>ksh</b>.)</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 $? 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>Also see <a href="#Error-Indicators">"Error Indicators"</a>.</p>
</li>
<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 wait() or waitpid(), or from the system()
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 $? 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>
</li>
<li><a name="%24%7b%5eENCODING%7d"></a><b>${^ENCODING}
</b>
<p>The <i>object reference</i> to the Encode object that is used to convert
the source code to Unicode.  Thanks to this variable your perl script
does not have to be written in UTF-8.  Default is <i>undef</i>.  The direct
manipulation of this variable is highly discouraged.</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>If used numerically, yields the current value of the C <code class="inline"><span class="w">errno</span></code>

variable, or in other words, if a system or library call fails, it
sets this variable.  This means that the value of <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>    if <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> else <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"># here $! is meaningless.</span></li></ol></pre><p>In the above <i>meaningless</i> stands for anything: zero, non-zero,
<code class="inline"><a class="l_k" href="functions/undef.html">undef</a></code>.  A successful system or library call does <b>not</b> set
the variable to zero.</p>
<p>If used as a string, yields the corresponding system error string.
You can assign a number to <code class="inline"><span class="i">$!</span></code>
 to set <i>errno</i> if, for instance,
you want <code class="inline"><span class="q">&quot;$!&quot;</span></code>
 to return the string for error <i>n</i>, or you want
to set the exit value for the die() operator.  (Mnemonic: What just
went bang?)</p>
<p>Also see <a href="#Error-Indicators">"Error Indicators"</a>.</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
&quot;No such file or directory&quot; (or its moral equivalent: not all operating
systems give that exact error, and certainly not all languages).
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 above for the
validity of <code class="inline"><span class="i">$!</span></code>
.</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"><span class="i">$!</span></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"><span class="i">$!</span></code>
 generally apply to
<code class="inline"><span class="i">$^E</span></code>
, also.  (Mnemonic: Extra error explanation.)</p>
<p>Also see <a href="#Error-Indicators">"Error Indicators"</a>.</p>
</li>
<li><a name="%24EVAL_ERROR"></a><b>$EVAL_ERROR</b>
</li>
<li><a name="%24%40"></a><b>$@
 </b>
<p>The Perl syntax error message from the last eval() operator.
If $@ is the null string, the last eval() parsed and executed
correctly (although the operations you invoked may have failed in the
normal fashion).  (Mnemonic: Where was the syntax error &quot;at&quot;?)</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 below.</p>
<p>Also see <a href="#Error-Indicators">"Error Indicators"</a>.</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.  You should
consider this variable read-only, although it will be altered
across fork() calls.  (Mnemonic: same as shells.)</p>
<p>Note for Linux users: on Linux, the C functions <code class="inline"><span class="i">getpid</span><span class="s">(</span><span class="s">)</span></code>
 and
<code class="inline"><a class="l_k" href="functions/getppid.html">getppid()</a></code> return different values from different threads. In order to
be portable, this behavior is not reflected by <code class="inline"><span class="i">$$</span></code>
, whose value remains
consistent across threads. If you want to call the underlying <code class="inline"><span class="i">getpid</span><span class="s">(</span><span class="s">)</span></code>
,
you may use the CPAN module <code class="inline"><span class="w">Linux::Pid</span></code>
.</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.  (Mnemonic: it&#39;s the uid you came <i>from</i>,
if you&#39;re running setuid.)  You can change both the real uid and
the effective uid at the same time by using POSIX::setuid().  Since
changes to $&lt; require a system call, check $! after a change attempt to 
detect any possible errors.</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.  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 uid</span></li></ol></pre><p>You can change both the effective uid and the real uid at the same
time by using POSIX::setuid().  Changes to $&gt; require a check to $!
to detect any possible errors after an attempted change.</p>
<p>(Mnemonic: it&#39;s the uid you went <i>to</i>, if you&#39;re running setuid.)
<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 setreuid().</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
getgid(), and the subsequent ones by getgroups(), 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 POSIX::setgid().  Changes to $( require a check to $!
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&#39;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 getegid(), and the subsequent ones by getgroups(), 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 setgroups().  To get the effect of an
empty list for setgroups(), just repeat the new effective gid; that is,
to force an effective gid of 5 and an effectively empty setgroups()
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 POSIX::setgid() (use only a single numeric argument).
Changes to $) require a check to $! to detect any possible errors
after an attempted change.</p>
<p>(Mnemonic: parentheses are used to <i>group</i> things.  The effective gid
is the group that&#39;s <i>right</i> for you, if you&#39;re running setgid.)</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 setregid().</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 (read: 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 $0 is more useful as a way of indicating the
current program state than it is for hiding the program you&#39;re
running.  (Mnemonic: same as <b>sh</b> and <b>ksh</b>.)</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 &quot;perl&quot;
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 &quot; (perl)&quot; 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>
</li>
<li><a name="%24%5b"></a><b>$[
</b>
<p>The index of the first element in an array, and of the first character
in a substring.  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.
(Mnemonic: [ begins subscripts.)</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&#39;s why you can only assign compile-time constants to it.)
Its use is highly discouraged.</p>
<p>Note that, unlike other compile-time directives (such as <a href="strict.html">strict</a>),
assignment to <code class="inline"><span class="i">$[</span></code>
 can be seen from outer lexical scopes in the same file.
However, you can use local() on it to strictly bind its value to a
lexical block.</p>
</li>
<li><a name="%24%5d"></a><b>$]
</b>
<p>The version + patchlevel / 1000 of the Perl interpreter.  This variable
can be used to determine whether the Perl interpreter executing a
script is in the right range of versions.  (Mnemonic: Is this version
of perl in the right bracket?)  Example:</p>
<pre class="verbatim"><ol><li>    <a class="l_k" href="functions/warn.html">warn</a> <span class="q">&quot;No checksumming!\n&quot;</span> if <span class="i">$]</span> &lt; <span class="n">3.019</span><span class="sc">;</span></li></ol></pre><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>The floating point representation can sometimes lead to inaccurate
numeric comparisons.  See <code class="inline"><span class="i">$^V</span></code>
 for a more modern representation of
the Perl version that allows accurate string comparisons.</p>
</li>
<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 AUTOLOAD 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>
</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.  (Mnemonic: value of <b>-D</b>
switch.) May be read or set. Like its command-line equivalent, you can use
numeric or symbolic values, eg <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>
.</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 re &#39;debug&#39; module is loaded. See <a href="re.html">re</a> for details.</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>
</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 exec()ed processes, while higher file
descriptors are not.  Also, during an open(), system file descriptors are
preserved even if the open() fails.  (Ordinary file descriptors are
closed before the open() 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 exec().</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 $^H 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 $^H.</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&#39;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 foo() is still
being compiled.  The new value of $^H will therefore be visible only while
the body of foo() is being compiled.</p>
<p>Substitution of the above BEGIN 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&#39;s a conditional
version of the same lexical pragma:</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> if <span class="i">$condition</span> <span class="s">}</span></li></ol></pre></li>
<li><a name="%25%5eH"></a><b>%^H</b>
<p>The %^H hash provides the same scoping semantic as $^H.  This makes it
useful for implementation of lexically scoped pragmas. See <a href="perlpragma.html">perlpragma</a>.</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.  (Mnemonic: value of <b>-i</b> switch.)</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 die()ing.  Suppose that your Perl
were compiled with <code class="inline">-<span class="w">DPERL_EMERGENCY_SBRK</span></code>
 and used Perl&#39;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>
</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.  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, $^O is not very helpful: since it is always
<code class="inline"><span class="w">MSWin32</span></code>
, it doesn&#39;t tell the difference between
95/98/ME/NT/2000/XP/CE/.NET.  Use Win32::GetOSName() 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>
</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>
</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>
<ol>
<li><a name="0x01"></a><b>x01</b>
<p>Debug subroutine enter/exit.</p>
</li>
<li><a name="0x02"></a><b>x02</b>
<p>Line-by-line debugging. Causes DB::DB() subroutine to be called for each
statement executed. Also causes saving source code lines (like 0x400).</p>
</li>
<li><a name="0x04"></a><b>x04</b>
<p>Switch off optimizations.</p>
</li>
<li><a name="0x08"></a><b>x08</b>
<p>Preserve more data for future interactive inspections.</p>
</li>
<li><a name="0x10"></a><b>x10</b>
<p>Keep info about source lines on which a subroutine is defined.</p>
</li>
<li><a name="0x20"></a><b>x20</b>
<p>Start with single-step on.</p>
</li>
<li><a name="0x40"></a><b>x40</b>
<p>Use subroutine address instead of name when reporting.</p>
</li>
<li><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>
</li>
<li><a name="0x100"></a><b>x100</b>
<p>Provide informative &quot;file&quot; names for evals based on the place they were compiled.</p>
</li>
<li><a name="0x200"></a><b>x200</b>
<p>Provide informative names to anonymous subroutines based on the place they
were compiled.</p>
</li>
<li><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>
</li>
</ol>
<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="%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>
</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>    $^S         State</li><li>    ---------   -------------------</li><li>    undef       Parsing module/eval</li><li>    true (1)    Executing an eval</li><li>    false (0)   Otherwise</li></ol></pre><p>The first state may happen in $SIG{__DIE__} and $SIG{__WARN__} handlers.</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="%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>).  This variable is read-only.</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. This variable is set during Perl startup
and is thereafter read-only.</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>
</li>
<li><a name="%24%7b%5eUTF8LOCALE%7d"></a><b>${^UTF8LOCALE}</b>
<p>This variable indicates whether an UTF-8 locale was detected by perl at
startup. This information is used by perl when it&#39;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>
</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 <code class="inline"><span class="w">version</span></code>
 object.</p>
<p>This variable first appeared in perl 5.6.0; earlier versions of perl will
see an undefined value. Before perl 5.10.0 $^V was represented as a v-string.</p>
<p>$^V can be used to determine whether the Perl interpreter executing a
script is in the right range of versions.  (Mnemonic: use ^V for Version
Control.)  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>To convert <code class="inline"><span class="i">$^V</span></code>
 into its string representation use sprintf()&#39;s
<code class="inline"><span class="q">&quot;%vd&quot;</span></code>
 conversion:</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"><span class="i">$]</span></code>
 for an older representation of the Perl version.</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.  (Mnemonic:
related to the <b>-w</b> switch.)  See also <a href="warnings.html">warnings</a>.</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.
See the documentation of <code class="inline"><span class="w">warnings</span></code>
 for more details.</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 stat() 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 &quot;sloppy&quot; stat() by
default.  See <a href="perlrun.html">perlrun</a> for more information about site
customization.</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&#39;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 $^X 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 $^X is in PATH.  For VMS, the
value may or may not include a version number.</p>
<p>You usually can use the value of $^X 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 $^X 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 $^X 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>  <span class="i">$this_perl</span> = <span class="i">$^X</span><span class="sc">;</span></li><li>  if <span class="s">(</span><span class="i">$^O</span> ne <span class="q">&#39;VMS&#39;</span><span class="s">)</span></li><li>     <span class="s">{</span><span class="i">$this_perl</span> .= <span class="i">$Config</span>{<span class="w">_exe</span>}</li><li>          unless <span class="i">$this_perl</span> =~ <span class="q">m/$Config{_exe}$/i</span><span class="sc">;</span><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 $^X.  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>  <span class="i">$secure_perl_path</span> = <span class="i">$Config</span>{<span class="w">perlpath</span>}<span class="sc">;</span></li><li>  if <span class="s">(</span><span class="i">$^O</span> ne <span class="q">&#39;VMS&#39;</span><span class="s">)</span></li><li>     <span class="s">{</span><span class="i">$secure_perl_path</span> .= <span class="i">$Config</span>{<span class="w">_exe</span>}</li><li>          unless <span class="i">$secure_perl_path</span> =~ <span class="q">m/$Config{_exe}$/i</span><span class="sc">;</span><span class="s">}</span></li></ol></pre></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="%24ARGV"></a><b>$ARGV
</b>
<p>contains the name of the current file when reading from &lt;&gt;.</p>
</li>
<li><a name="%40ARGV"></a><b>@ARGV
</b>
<p>The array @ARGV 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&#39;s
command name itself.  See <code class="inline"><span class="i">$0</span></code>
 for the command name.</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&#39;t want to keep modifying $_.  See
<a href="perlrun.html">perlrun</a> for the <b>-i</b> switch.</p>
</li>
<li><a name="%40F"></a><b>@F
</b>
<p>The array @F 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 @INC 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 &quot;.&quot;, to represent the current
directory.  (&quot;.&quot; will not be appended if taint checks are enabled, either by
<code class="inline">-T</code>
 or by <code class="inline">-t</code>
.)  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 @INC.  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="%40ARG"></a><b>@ARG</b>
</li>
<li><a name="%40_"></a><b>@_
 </b>
<p>Within a subroutine the array @_ contains the parameters passed to that
subroutine.  See <a href="perlsub.html">perlsub</a>.</p>
</li>
<li><a name="%25INC"></a><b>%INC
</b>
<p>The hash %INC 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 %INC in place of a filename.  Note, however,
that the hook may have set the %INC entry by itself to provide some more
specific info.</p>
</li>
<li><a name="%25ENV"></a><b>%ENV</b>
</li>
<li><a name="%24ENV%7bexpr%7d"></a><b>$ENV{expr}
</b>
<p>The hash %ENV 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 fork() off.</p>
</li>
<li><a name="%25SIG"></a><b>%SIG</b>
</li>
<li><a name="%24SIG%7bexpr%7d"></a><b>$SIG{expr}
</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 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 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() 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 sigaction() 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 5.8.0 from 
immediate (also known as &quot;unsafe&quot;) to deferred, also known as 
&quot;safe signals&quot;.  See <a href="perlipc.html">perlipc</a> for more information.</p>
<p>Certain internal hooks can be also set using the %SIG 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></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>Due to an implementation glitch, the <code class="inline"><span class="i">$SIG</span>{<span class="w">__DIE__</span>}</code>
 hook is called
even inside an eval().  Do not use this to rewrite a pending exception
in <code class="inline"><span class="i">$@</span></code>
, or as a bizarre substitute for overriding <code class="inline"><span class="i">CORE::GLOBAL::die</span><span class="s">(</span><span class="s">)</span></code>
.
This strange action at a distance may be fixed in a future release
so that <code class="inline"><span class="i">$SIG</span>{<span class="w">__DIE__</span>}</code>
 is only called if your program is about
to exit, as was the original intent.  Any other use is deprecated.</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> if <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> if <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 backtrace...</span></li><li>         <span class="q">         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 Carp <i>unless</i> it is the parser who
called the handler.  The second line will print backtrace and die if
Carp was available.  The third line will be executed only if Carp was
not available.</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>
</ul>
<a name="Error-Indicators"></a><h2>Error Indicators
 </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 &quot;distance&quot; 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:</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>After execution of this statement all 4 variables may have been set.</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 die()d .  In these cases
the value of $@ 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>When the eval() expression above is executed, open(), <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> are translated to calls in the C run-time library and
thence to the operating system kernel.  <code class="inline"><span class="i">$!</span></code>
 is set to the C library&#39;s
<code class="inline"><span class="w">errno</span></code>
 if one of these calls fails.</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, &quot;CDROM tray not closed.&quot;
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 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&#39;s exit()
value).   The lower eight bits reflect mode of failure, like signal
death and core dump information  See wait(2) 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 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 eval() 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>
<a name="Technical-Note-on-the-Syntax-of-Variable-Names"></a><h2>Technical Note on 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>.</p>
<p>Perl variable names may also be a sequence of digits or a single
punctuation or control character.  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.  Perl has a special syntax for the single-control-character
names: It understands <code class="inline">^X</code> (caret <code class="inline"><span class="w">X</span></code>
) to mean the control-<code class="inline"><span class="w">X</span></code>

character.  For example, the notation <code class="inline"><span class="i">$^W</span></code>
 (dollar-sign caret
<code class="inline"><span class="w">W</span></code>
) is the scalar variable whose name is the single character
control-<code class="inline"><span class="w">W</span></code>
.  This is better than typing a literal control-<code class="inline"><span class="w">W</span></code>

into your program.</p>
<p>Finally, new in Perl 5.6, Perl variable names may be alphanumeric
strings that begin with control characters (or better yet, a caret).
These variables must 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 a control-<code class="inline"><span class="w">F</span></code>
 followed by two <code class="inline"><span class="w">o</span></code>
&#39;s.  These variables are
reserved for future special uses by Perl, except for the ones that
begin with <code class="inline">^_</code> (control-underscore or caret-underscore).  No
control-character 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, control characters, 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>		<span class="w">_</span></li><li>	<span class="w">SIG</span></li></ol></pre><p>In particular, the new 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="BUGS"></a><h1>BUGS</h1>
<p>Due to an unfortunate accident of Perl&#39;s implementation, <code class="inline"><a class="l_k" href="functions/use.html">use</a>
<span class="w">English</span></code>
 imposes a considerable performance penalty on all regular
expression matches in a program, regardless of whether they occur
in the scope of <code class="inline"><a class="l_k" href="functions/use.html">use</a> <span class="w">English</span></code>
.  For that reason, saying <code class="inline"><a class="l_k" href="functions/use.html">use</a>
<span class="w">English</span></code>
 in libraries is strongly discouraged.  See the
Devel::SawAmpersand module documentation from CPAN
( <a href="http://www.cpan.org/modules/by-module/Devel/">http://www.cpan.org/modules/by-module/Devel/</a> )
for more information. Writing <code class="inline"><a class="l_k" href="functions/use.html">use</a> <span class="w">English</span> <span class="q">'-no_match_vars'</span><span class="sc">;</span></code>

avoids the performance penalty.</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>




  <div id="page_index">
    <div id="page_index_header">
      <div id="page_index_close"><a href="#" onClick="pageIndex.hide();return false;"></a></div>
      <div id="page_index_title"><span class="page_index_top">Page index</span></div>
      <div id="page_index_topright"></div>
    </div>
    <div id="page_index_content">
      <ul><li><a href="#NAME">NAME</a><li><a href="#DESCRIPTION">DESCRIPTION</a><ul><li><a href="#Predefined-Names">Predefined Names</a><li><a href="#Error-Indicators">Error Indicators
 </a><li><a href="#Technical-Note-on-the-Syntax-of-Variable-Names">Technical Note on the Syntax of Variable Names</a></ul><li><a href="#BUGS">BUGS</a></ul>
    </div>
    <div id="page_index_footer">
      <div id="page_index_bottomleft"></div>
      <div id="page_index_bottom"><span class="page_index_bottom"></span></div>
      <div id="page_index_resize"></div>
    </div>
  </div>


	    &nbsp;
          </div>
          <div id="content_footer">
          </div>
        </div>
        <div id="right_column">
          <div class="side_group">
	    
            <div class="side_panel tools_panel">
              <p>Recently read</p>
              <div id="recent_pages"></div>
            </div>
            <div class="side_panel tools_panel">
              <p>Tools</p>
              <ul>
		<li><a href="preferences.html">Preferences</a>
              </ul>
            </div>
          </div>
        </div>
        <div class="clear"></div>
      </div>
      
      <div id="footer">
	<div id="footer_content">
	  
	</div>
      </div>
      
    </div>
      <script language="JavaScript" src="static/combined-20090809.js" type="text/javascript"></script>
<script language="JavaScript" type="text/javascript">
  perldoc.setPath(0);
  perldoc.pageName    = 'perlvar';
  perldoc.pageAddress = 'perlvar.html';
  perldoc.contentPage = 1;
</script>
    
  </body>
</html>