Advertisement
opexxx

perl1line.txt

Nov 23rd, 2013
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 18.30 KB | None | 0 0
  1.  
  2. Useful One-Line Scripts for Perl                    Jan 28 2012 | version 1.08
  3. --------------------------------                    -----------   ------------
  4.  
  5. Compiled by Peteris Krumins (peter@catonmat.net, @pkrumins on Twitter)
  6. http://www.catonmat.net -- good coders code, great reuse
  7.  
  8. Latest version of this file is always at:
  9.  
  10.     http://www.catonmat.net/download/perl1line.txt
  11.  
  12. This file is also available in other languages:
  13.     (None at the moment.)
  14.     Please email me peter@catonmat.net if you wish to translate it.
  15.  
  16. Perl One-Liners on Github:
  17.  
  18.     https://github.com/pkrumins/perl1line.txt
  19.  
  20.     You can send me pull requests over GitHub! I accept bug fixes,
  21.     new one-liners, translations and everything else related.
  22.  
  23. I have also written "Perl One-Liners Explained" ebook that's based on
  24. this file. It explains all the one-liners here. Get it at:
  25.  
  26.    http://www.catonmat.net/blog/perl-book/
  27.  
  28. These one-liners work both on UNIX systems and Windows. Most likely your
  29. UNIX system already has Perl. For Windows get the Strawberry Perl at:
  30.  
  31.    http://www.strawberryperl.com/
  32.  
  33. Table of contents:
  34.  
  35.    1. File Spacing
  36.    2. Line Numbering
  37.    3. Calculations
  38.    4. String Creation and Array Creation
  39.    5. Text Conversion and Substitution
  40.    6. Selective Printing and Deleting of Certain Lines    
  41.    7. Handy Regular Expressions
  42.    8. Perl tricks
  43.  
  44.  
  45. FILE SPACING
  46. ------------
  47.  
  48. # Double space a file
  49. perl -pe '$\="\n"'
  50. perl -pe 'BEGIN { $\="\n" }'
  51. perl -pe '$_ .= "\n"'
  52. perl -pe 's/$/\n/'
  53.  
  54. # Double space a file, except the blank lines
  55. perl -pe '$_ .= "\n" unless /^$/'
  56. perl -pe '$_ .= "\n" if /\S/'
  57.  
  58. # Triple space a file
  59. perl -pe '$\="\n\n"'
  60. perl -pe '$_.="\n\n"'
  61.  
  62. # N-space a file
  63. perl -pe '$_.="\n"x7'
  64.  
  65. # Add a blank line before every line
  66. perl -pe 's//\n/'
  67.  
  68. # Remove all blank lines
  69. perl -ne 'print unless /^$/'
  70. perl -lne 'print if length'
  71. perl -ne 'print if /\S/'
  72.  
  73. # Remove all consecutive blank lines, leaving just one
  74. perl -00 -pe ''
  75. perl -00pe0
  76.  
  77. # Compress/expand all blank lines into N consecutive ones
  78. perl -00 -pe '$_.="\n"x4'
  79.  
  80. # Fold a file so that every set of 10 lines becomes one tab-separated line
  81. perl -lpe '$\ = $. % 10 ? "\t" : "\n"'
  82.  
  83.  
  84. LINE NUMBERING
  85. --------------
  86.  
  87. # Number all lines in a file
  88. perl -pe '$_ = "$. $_"'
  89.  
  90. # Number only non-empty lines in a file
  91. perl -pe '$_ = ++$a." $_" if /./'
  92.  
  93. # Number and print only non-empty lines in a file (drop empty lines)
  94. perl -ne 'print ++$a." $_" if /./'
  95.  
  96. # Number all lines but print line numbers only non-empty lines
  97. perl -pe '$_ = "$. $_" if /./'
  98.  
  99. # Number only lines that match a pattern, print others unmodified
  100. perl -pe '$_ = ++$a." $_" if /regex/'
  101.  
  102. # Number and print only lines that match a pattern
  103. perl -ne 'print ++$a." $_" if /regex/'
  104.  
  105. # Number all lines, but print line numbers only for lines that match a pattern
  106. perl -pe '$_ = "$. $_" if /regex/'
  107.  
  108. # Number all lines in a file using a custom format (emulate cat -n)
  109. perl -ne 'printf "%-5d %s", $., $_'
  110.  
  111. # Print the total number of lines in a file (emulate wc -l)
  112. perl -lne 'END { print $. }'
  113. perl -le 'print $n=()=<>'
  114. perl -le 'print scalar(()=<>)'
  115. perl -le 'print scalar(@foo=<>)'
  116. perl -ne '}{print $.'
  117. perl -nE '}{say $.'
  118.  
  119. # Print the number of non-empty lines in a file
  120. perl -le 'print scalar(grep{/./}<>)'
  121. perl -le 'print ~~grep{/./}<>'
  122. perl -le 'print~~grep/./,<>'
  123. perl -E 'say~~grep/./,<>'
  124.  
  125. # Print the number of empty lines in a file
  126. perl -lne '$a++ if /^$/; END {print $a+0}'
  127. perl -le 'print scalar(grep{/^$/}<>)'
  128. perl -le 'print ~~grep{/^$/}<>'
  129. perl -E 'say~~grep{/^$/}<>'
  130.  
  131. # Print the number of lines in a file that match a pattern (emulate grep -c)
  132. perl -lne '$a++ if /regex/; END {print $a+0}'
  133. perl -nE '$a++ if /regex/; END {say $a+0}'
  134.  
  135.  
  136. CALCULATIONS
  137. ------------
  138.  
  139. # Check if a number is a prime
  140. perl -lne '(1x$_) !~ /^1?$|^(11+?)\1+$/ && print "$_ is prime"'
  141.  
  142. # Print the sum of all the fields on a line
  143. perl -MList::Util=sum -alne 'print sum @F'
  144.  
  145. # Print the sum of all the fields on all lines
  146. perl -MList::Util=sum -alne 'push @S,@F; END { print sum @S }'
  147. perl -MList::Util=sum -alne '$s += sum @F; END { print $s }'
  148.  
  149. # Shuffle all fields on a line
  150. perl -MList::Util=shuffle -alne 'print "@{[shuffle @F]}"'
  151. perl -MList::Util=shuffle -alne 'print join " ", shuffle @F'
  152.  
  153. # Find the minimum element on a line
  154. perl -MList::Util=min -alne 'print min @F'
  155.  
  156. # Find the minimum element over all the lines
  157. perl -MList::Util=min -alne '@M = (@M, @F); END { print min @M }'
  158. perl -MList::Util=min -alne '$min = min @F; $rmin = $min unless defined $rmin && $min > $rmin; END { print $rmin }'
  159.  
  160. # Find the maximum element on a line
  161. perl -MList::Util=max -alne 'print max @F'
  162.  
  163. # Find the maximum element over all the lines
  164. perl -MList::Util=max -alne '@M = (@M, @F); END { print max @M }'
  165.  
  166. # Replace each field with its absolute value
  167. perl -alne 'print "@{[map { abs } @F]}"'
  168.  
  169. # Find the total number of fields (words) on each line
  170. perl -alne 'print scalar @F'
  171.  
  172. # Print the total number of fields (words) on each line followed by the line
  173. perl -alne 'print scalar @F, " $_"'
  174.  
  175. # Find the total number of fields (words) on all lines
  176. perl -alne '$t += @F; END { print $t}'
  177.  
  178. # Print the total number of fields that match a pattern
  179. perl -alne 'map { /regex/ && $t++ } @F; END { print $t }'
  180. perl -alne '$t += /regex/ for @F; END { print $t }'
  181. perl -alne '$t += grep /regex/, @F; END { print $t }'
  182.  
  183. # Print the total number of lines that match a pattern
  184. perl -lne '/regex/ && $t++; END { print $t }'
  185.  
  186. # Print the number PI to n decimal places
  187. perl -Mbignum=bpi -le 'print bpi(n)'
  188.  
  189. # Print the number PI to 39 decimal places
  190. perl -Mbignum=PI -le 'print PI'
  191.  
  192. # Print the number E to n decimal places
  193. perl -Mbignum=bexp -le 'print bexp(1,n+1)'
  194.  
  195. # Print the number E to 39 decimal places
  196. perl -Mbignum=e -le 'print e'
  197.  
  198. # Print UNIX time (seconds since Jan 1, 1970, 00:00:00 UTC)
  199. perl -le 'print time'
  200.  
  201. # Print GMT (Greenwich Mean Time) and local computer time
  202. perl -le 'print scalar gmtime'
  203. perl -le 'print scalar localtime'
  204.  
  205. # Print local computer time in H:M:S format
  206. perl -le 'print join ":", (localtime)[2,1,0]'
  207.  
  208. # Print yesterday's date
  209. perl -MPOSIX -le '@now = localtime; $now[3] -= 1; print scalar localtime mktime @now'
  210.  
  211. # Print date 14 months, 9 days and 7 seconds ago
  212. perl -MPOSIX -le '@now = localtime; $now[0] -= 7; $now[4] -= 14; $now[7] -= 9; print scalar localtime mktime @now'
  213.  
  214. # Prepend timestamps to stdout (GMT, localtime)
  215. tail -f logfile | perl -ne 'print scalar gmtime," ",$_'
  216. tail -f logfile | perl -ne 'print scalar localtime," ",$_'
  217.  
  218. # Calculate factorial of 5
  219. perl -MMath::BigInt -le 'print Math::BigInt->new(5)->bfac()'
  220. perl -le '$f = 1; $f *= $_ for 1..5; print $f'
  221.  
  222. # Calculate greatest common divisor (GCM)
  223. perl -MMath::BigInt=bgcd -le 'print bgcd(@list_of_numbers)'
  224.  
  225. # Calculate GCM of numbers 20 and 35 using Euclid's algorithm
  226. perl -le '$n = 20; $m = 35; ($m,$n) = ($n,$m%$n) while $n; print $m'
  227.  
  228. # Calculate least common multiple (LCM) of numbers 35, 20 and 8
  229. perl -MMath::BigInt=blcm -le 'print blcm(35,20,8)'
  230.  
  231. # Calculate LCM of 20 and 35 using Euclid's formula: n*m/gcd(n,m)
  232. perl -le '$a = $n = 20; $b = $m = 35; ($m,$n) = ($n,$m%$n) while $n; print $a*$b/$m'
  233.  
  234. # Generate 10 random numbers between 5 and 15 (excluding 15)
  235. perl -le '$n=10; $min=5; $max=15; $, = " "; print map { int(rand($max-$min))+$min } 1..$n'
  236.  
  237. # Find and print all permutations of a list
  238. perl -MAlgorithm::Permute -le '$l = [1,2,3,4,5]; $p = Algorithm::Permute->new($l); print @r while @r = $p->next'
  239.  
  240. # Generate the power set
  241. perl -MList::PowerSet=powerset -le '@l = (1,2,3,4,5); for (@{powerset(@l)}) { print "@$_" }'
  242.  
  243. # Convert an IP address to unsigned integer
  244. perl -le '$i=3; $u += ($_<<8*$i--) for "127.0.0.1" =~ /(\d+)/g; print $u'
  245. perl -le '$ip="127.0.0.1"; $ip =~ s/(\d+)\.?/sprintf("%02x", $1)/ge; print hex($ip)'
  246. perl -le 'print unpack("N", 127.0.0.1)'
  247. perl -MSocket -le 'print unpack("N", inet_aton("127.0.0.1"))'
  248.  
  249. # Convert an unsigned integer to an IP address
  250. perl -MSocket -le 'print inet_ntoa(pack("N", 2130706433))'
  251. perl -le '$ip = 2130706433; print join ".", map { (($ip>>8*($_))&0xFF) } reverse 0..3'
  252. perl -le '$ip = 2130706433; $, = "."; print map { (($ip>>8*($_))&0xFF) } reverse 0..3'
  253.  
  254.  
  255. STRING CREATION AND ARRAY CREATION
  256. ----------------------------------
  257.  
  258. # Generate and print the alphabet
  259. perl -le 'print a..z'
  260. perl -le 'print ("a".."z")'
  261. perl -le '$, = ","; print ("a".."z")'
  262. perl -le 'print join ",", ("a".."z")'
  263.  
  264. # Generate and print all the strings from "a" to "zz"
  265. perl -le 'print ("a".."zz")'
  266. perl -le 'print "aa".."zz"'
  267.  
  268. # Create a hex lookup table
  269. @hex = (0..9, "a".."f")
  270.  
  271. # Convert a decimal number to hex using @hex lookup table
  272. perl -le '$num = 255; @hex = (0..9, "a".."f"); while ($num) { $s = $hex[($num%16)&15].$s; $num = int $num/16 } print $s'
  273. perl -le '$hex = sprintf("%x", 255); print $hex'
  274. perl -le '$num = "ff"; print hex $num'
  275.  
  276. # Generate a random 8 character password
  277. perl -le 'print map { ("a".."z")[rand 26] } 1..8'
  278. perl -le 'print map { ("a".."z", 0..9)[rand 36] } 1..8'
  279.  
  280. # Create a string of specific length
  281. perl -le 'print "a"x50'
  282.  
  283. # Create a repeated list of elements
  284. perl -le '@list = (1,2)x20; print "@list"'
  285.  
  286. # Create an array from a string
  287. @months = split ' ', "Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec"
  288. @months = qw/Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec/
  289.  
  290. # Create a string from an array
  291. @stuff = ("hello", 0..9, "world"); $string = join '-', @stuff
  292.  
  293. # Find the numeric values for characters in the string
  294. perl -le 'print join ", ", map { ord } split //, "hello world"'
  295.  
  296. # Convert a list of numeric ASCII values into a string
  297. perl -le '@ascii = (99, 111, 100, 105, 110, 103); print pack("C*", @ascii)'
  298. perl -le '@ascii = (99, 111, 100, 105, 110, 103); print map { chr } @ascii'
  299.  
  300. # Generate an array with odd numbers from 1 to 100
  301. perl -le '@odd = grep {$_ % 2 == 1} 1..100; print "@odd"'
  302. perl -le '@odd = grep { $_ & 1 } 1..100; print "@odd"'
  303.  
  304. # Generate an array with even numbers from 1 to 100
  305. perl -le '@even = grep {$_ % 2 == 0} 1..100; print "@even"'
  306.  
  307. # Find the length of the string
  308. perl -le 'print length "one-liners are great"'
  309.  
  310. # Find the number of elements in an array
  311. perl -le '@array = ("a".."z"); print scalar @array'
  312. perl -le '@array = ("a".."z"); print $#array + 1'
  313.  
  314.  
  315. TEXT CONVERSION AND SUBSTITUTION
  316. --------------------------------
  317.  
  318. # ROT13 a string
  319. 'y/A-Za-z/N-ZA-Mn-za-m/'
  320.  
  321. # ROT 13 a file
  322. perl -lpe 'y/A-Za-z/N-ZA-Mn-za-m/' file
  323.  
  324. # Base64 encode a string
  325. perl -MMIME::Base64 -e 'print encode_base64("string")'
  326. perl -MMIME::Base64 -0777 -ne 'print encode_base64($_)' file
  327.  
  328. # Base64 decode a string
  329. perl -MMIME::Base64 -le 'print decode_base64("base64string")'
  330. perl -MMIME::Base64 -ne 'print decode_base64($_)' file
  331.  
  332. # URL-escape a string
  333. perl -MURI::Escape -le 'print uri_escape($string)'
  334.  
  335. # URL-unescape a string
  336. perl -MURI::Escape -le 'print uri_unescape($string)'
  337.  
  338. # HTML-encode a string
  339. perl -MHTML::Entities -le 'print encode_entities($string)'
  340.  
  341. # HTML-decode a string
  342. perl -MHTML::Entities -le 'print decode_entities($string)'
  343.  
  344. # Convert all text to uppercase
  345. perl -nle 'print uc'
  346. perl -ple '$_=uc'
  347. perl -nle 'print "\U$_"'
  348.  
  349. # Convert all text to lowercase
  350. perl -nle 'print lc'
  351. perl -ple '$_=lc'
  352. perl -nle 'print "\L$_"'
  353.  
  354. # Uppercase only the first word of each line
  355. perl -nle 'print ucfirst lc'
  356. perl -nle 'print "\u\L$_"'
  357.  
  358. # Invert the letter case
  359. perl -ple 'y/A-Za-z/a-zA-Z/'
  360.  
  361. # Camel case each line
  362. perl -ple 's/(\w+)/\u$1/g'
  363. perl -ple 's/(?<!['])(\w+)/\u\1/g'
  364.  
  365. # Strip leading whitespace (spaces, tabs) from the beginning of each line
  366. perl -ple 's/^[ \t]+//'
  367. perl -ple 's/^\s+//'
  368.  
  369. # Strip trailing whitespace (space, tabs) from the end of each line
  370. perl -ple 's/[ \t]+$//'
  371.  
  372. # Strip whitespace from the beginning and end of each line
  373. perl -ple 's/^[ \t]+|[ \t]+$//g'
  374.  
  375. # Convert UNIX newlines to DOS/Windows newlines
  376. perl -pe 's|\n|\r\n|'
  377.  
  378. # Convert DOS/Windows newlines to UNIX newlines
  379. perl -pe 's|\r\n|\n|'
  380.  
  381. # Convert UNIX newlines to Mac newlines
  382. perl -pe 's|\n|\r|'
  383.  
  384. # Substitute (find and replace) "foo" with "bar" on each line
  385. perl -pe 's/foo/bar/'
  386.  
  387. # Substitute (find and replace) all "foo"s with "bar" on each line
  388. perl -pe 's/foo/bar/g'
  389.  
  390. # Substitute (find and replace) "foo" with "bar" on lines that match "baz"
  391. perl -pe '/baz/ && s/foo/bar/'
  392.  
  393. # Binary patch a file (find and replace a given array of bytes as hex numbers)
  394. perl -pi -e 's/\x89\xD8\x48\x8B/\x90\x90\x48\x8B/g' file
  395.  
  396.  
  397. SELECTIVE PRINTING AND DELETING OF CERTAIN LINES
  398. ------------------------------------------------
  399.  
  400. # Print the first line of a file (emulate head -1)
  401. perl -ne 'print; exit'
  402.  
  403. # Print the first 10 lines of a file (emulate head -10)
  404. perl -ne 'print if $. <= 10'
  405. perl -ne '$. <= 10 && print'
  406. perl -ne 'print if 1..10'
  407.  
  408. # Print the last line of a file (emulate tail -1)
  409. perl -ne '$last = $_; END { print $last }'
  410. perl -ne 'print if eof'
  411.  
  412. # Print the last 10 lines of a file (emulate tail -10)
  413. perl -ne 'push @a, $_; @a = @a[@a-10..$#a]; END { print @a }'
  414.  
  415. # Print only lines that match a regular expression
  416. perl -ne '/regex/ && print'
  417.  
  418. # Print only lines that do not match a regular expression
  419. perl -ne '!/regex/ && print'
  420.  
  421. # Print the line before a line that matches a regular expression
  422. perl -ne '/regex/ && $last && print $last; $last = $_'
  423.  
  424. # Print the line after a line that matches a regular expression
  425. perl -ne 'if ($p) { print; $p = 0 } $p++ if /regex/'
  426.  
  427. # Print lines that match regex AAA and regex BBB in any order
  428. perl -ne '/AAA/ && /BBB/ && print'
  429.  
  430. # Print lines that don't match match regexes AAA and BBB
  431. perl -ne '!/AAA/ && !/BBB/ && print'
  432.  
  433. # Print lines that match regex AAA followed by regex BBB followed by CCC
  434. perl -ne '/AAA.*BBB.*CCC/ && print'
  435.  
  436. # Print lines that are 80 chars or longer
  437. perl -ne 'print if length >= 80'
  438.  
  439. # Print lines that are less than 80 chars in length
  440. perl -ne 'print if length < 80'
  441.  
  442. # Print only line 13
  443. perl -ne '$. == 13 && print && exit'
  444.  
  445. # Print all lines except line 27
  446. perl -ne '$. != 27 && print'
  447. perl -ne 'print if $. != 27'
  448.  
  449. # Print only lines 13, 19 and 67
  450. perl -ne 'print if $. == 13 || $. == 19 || $. == 67'
  451. perl -ne 'print if int($.) ~~ (13, 19, 67)'
  452.  
  453. # Print all lines between two regexes (including lines that match regex)
  454. perl -ne 'print if /regex1/../regex2/'
  455.  
  456. # Print all lines from line 17 to line 30
  457. perl -ne 'print if $. >= 17 && $. <= 30'
  458. perl -ne 'print if int($.) ~~ (17..30)'
  459. perl -ne 'print if grep { $_ == $. } 17..30'
  460.  
  461. # Print the longest line
  462. perl -ne '$l = $_ if length($_) > length($l); END { print $l }'
  463.  
  464. # Print the shortest line
  465. perl -ne '$s = $_ if $. == 1; $s = $_ if length($_) < length($s); END { print $s }'
  466.  
  467. # Print all lines that contain a number
  468. perl -ne 'print if /\d/'
  469.  
  470. # Find all lines that contain only a number
  471. perl -ne 'print if /^\d+$/'
  472.  
  473. # Print all lines that contain only characters
  474. perl -ne 'print if /^[[:alpha:]]+$/
  475.  
  476. # Print every second line
  477. perl -ne 'print if $. % 2'
  478.  
  479. # Print every second line, starting the second line
  480. perl -ne 'print if $. % 2 == 0'
  481.  
  482. # Print all lines that repeat
  483. perl -ne 'print if ++$a{$_} == 2'
  484.  
  485. # Print all unique lines
  486. perl -ne 'print unless $a{$_}++'
  487.  
  488. # Print the first field (word) of every line (emulate cut -f 1 -d ' ')
  489. perl -alne 'print $F[0]'
  490.  
  491.  
  492. HANDY REGULAR EXPRESSIONS
  493. -------------------------
  494.  
  495. # Match something that looks like an IP address
  496. /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/
  497. /^(\d{1,3}\.){3}\d{1,3}$/
  498.  
  499. # Test if a number is in range 0-255
  500. /^([0-9]|[0-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])$/
  501.  
  502. # Match an IP address
  503. my $ip_part = qr|([0-9]|[0-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])|;
  504. if ($ip =~ /^($ip_part\.){3}$ip_part$/) {
  505. say "valid ip";
  506. }
  507.  
  508. # Check if the string looks like an email address
  509. /\S+@\S+\.\S+/
  510.  
  511. # Check if the string is a decimal number
  512. /^\d+$/
  513. /^[+-]?\d+$/
  514. /^[+-]?\d+\.?\d*$/
  515.  
  516. # Check if the string is a hexadecimal number
  517. /^0x[0-9a-f]+$/i
  518.  
  519. # Check if the string is an octal number
  520. /^0[0-7]+$/
  521.  
  522. # Check if the string is binary
  523. /^[01]+$/
  524.  
  525. # Check if a word appears twice in the string
  526. /(word).*\1/
  527.  
  528. # Increase all numbers by one in the string
  529. $str =~ s/(\d+)/$1+1/ge
  530.  
  531. # Extract HTTP User-Agent string from the HTTP headers
  532. /^User-Agent: (.+)$/
  533.  
  534. # Match printable ASCII characters
  535. /[ -~]/
  536.  
  537. # Match unprintable ASCII characters
  538. /[^ -~]/
  539.  
  540. # Match text between two HTML tags
  541. m|<strong>([^<]*)</strong>|
  542. m|<strong>(.*?)</strong>|
  543.  
  544. # Replace all <b> tags with <strong>
  545. $html =~ s|<(/)?b>|<$1strong>|g
  546.  
  547. # Extract all matches from a regular expression
  548. my @matches = $text =~ /regex/g;
  549.  
  550.  
  551. PERL TRICKS
  552. -----------
  553.  
  554. # Print the version of a Perl module
  555. perl -MModule -le 'print $Module::VERSION'
  556. perl -MLWP::UserAgent -le 'print $LWP::UserAgent::VERSION'
  557.  
  558.  
  559. PERL ONE-LINERS EXPLAINED E-BOOK
  560. --------------------------------
  561.  
  562. I have written an ebook based on the one-liners in this file. If you wish to
  563. support my work and learn more about these one-liners, you can get a copy
  564. of my ebook at:
  565.  
  566.    http://www.catonmat.net/blog/perl-book/
  567.  
  568. The ebook is based on the 7-part article series that I wrote on my blog.
  569. In the ebook I reviewed all the one-liners, improved explanations, added
  570. new ones, and added two new chapters - introduction to Perl one-liners
  571. and summary of commonly used special variables.
  572.  
  573. You can read the original article series here:
  574.  
  575.    http://www.catonmat.net/blog/perl-one-liners-explained-part-one/
  576.    http://www.catonmat.net/blog/perl-one-liners-explained-part-two/
  577.    http://www.catonmat.net/blog/perl-one-liners-explained-part-three/
  578.    http://www.catonmat.net/blog/perl-one-liners-explained-part-four/
  579.    http://www.catonmat.net/blog/perl-one-liners-explained-part-five/
  580.    http://www.catonmat.net/blog/perl-one-liners-explained-part-six/
  581.    http://www.catonmat.net/blog/perl-one-liners-explained-part-seven/
  582.  
  583.  
  584. CREDITS
  585. -------
  586.  
  587. Andy Lester       http://www.petdance.com
  588. Shlomi Fish       http://www.shlomifish.org
  589. Madars Virza      http://www.madars.org
  590. caffecaldo        https://github.com/caffecaldo
  591. Kirk Kimmel       https://github.com/kimmel
  592. avar              https://github.com/avar
  593. rent0n
  594.  
  595.  
  596. FOUND A BUG? HAVE ANOTHER ONE-LINER?
  597. ------------------------------------
  598.  
  599. Email bugs and new one-liners to me at peter@catonmat.net!
  600.  
  601.  
  602. HAVE FUN
  603. --------
  604.  
  605. I hope you found these one-liners useful. Have fun!
  606.  
  607. #---end of file---
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement