Perl
Learn Perl by typing pragmatic, idiomatic code.
Practice Perl by typing its signature tools: powerful regular expressions, hashes and arrays, the sigils ($, @, %) that mark context, and text-munging one-liners. Each snippet is idiomatic Perl, and an AI tutor explains every line — how context changes what an expression returns, what a regex capture grabs — so Perl's terseness becomes readable as you build speed.
Progress0 / 682 solved · 0/50 sections
best wpm
0
avg wpm
0
accuracy
0%
runs
0
level
1
rating
1000
Run Perl on your machine
1. Install the toolchain
perl is preinstalled on macOS/Linux # or: brew install perl2. Save your code as hello.pl, then compile & run
perl hello.plprogress by section
2Strings In Depth0/18start →
String lengthChange caseConcatenate with .String interpolationFind with indexJoin a listprintf directlyRepeat with xReverse a stringSplit into a listSubstitute with s///Extract with substrHeredoc blocksMatch and captureFormat with sprintfReplace with 4-arg substrTransliterate with trGlobal substitute
3Values & References0/18start →
Array referenceHash referenceWhat ref() reportsScalar referenceforeach aliasesAnonymous arrayAnonymous hashThe arrow operatorMutate through a refReturn a referenceCode referencesCopy vs sharedDispatch tableRefs keep lists separateDeep dereferencePostfix dereferenceReference identityBreak a cycle with weaken
4Slices & Arrays0/18Unlock →
5Data structures0/9Unlock →
6Iterators0/20Unlock →
sum / product / countchain two listsindex with each elementgrep to filtermap to a new liststride and reverseslice by positiontransform and drop in one passmin and max by a keypartition by a predicatereduce with a start valuereduce without an initany / all / first / positionslice by a running conditionzip and unzipa closure iteratorbuild a hash from a listflatten and expandrunning totalsall-or-nothing parse
7Traits0/20Unlock →
Default via hash mergeOperator + overloadDeep clone vs shallow copyFrom conversionObject as hash keyOperator unary negOrdering via <=>PartialEq via overloadOperator += overloadCustom stringificationDrop via DESTROYOperator * by scalarTryFrom fallibleAssociated item typeDeref via delegationIndex emulationIntoIterator via closureCustom iteratorBuild aggregate from a listRole via @ISA + duck typing
8Generics0/20Unlock →
A generic containerDuck typing via can()A tagged unionOne sub, any typeA pair of any valuesCall a method only if presentReturn a stateful closureCheck the constraint explicitlyProduce a default by typeSize fixed at constructionAccept any iterableMethods on a containerGeneric min over a listConstrain by capabilitiesA wrapper that adds meaningSum anything numericOne behavior for every valueFixed vs dynamic method nameMax by a key functionA type tag in the class name
9Lifetimes0/20Unlock →
No dangling references in PerlA closure capturing a variableA coderef with no captured stateA subroutine returning a referenceAn accessor returning a fieldA program-lifetime variable and localA tagged variant holding a referenceA method returning its stored referenceA reference wrapperDESTROY fires when the last ref dropsA reference to an array elementA blessed object storing a referenceTwo references and a cycleA generic wrapper over any valueThe longest string in an arrayrefAn object mutating shared dataA parser borrowing its inputA reference tied to one argumentPrinting any value by referenceA closure iterator over an arrayref
10Closures0/20Unlock →
An anonymous subCapturing a variableMultiple parametersUnpack @_ and use a blockA callbackCapturing in grepA sub as an argumentClosures drive iteratorsReference a named subCapture a private copyA comparator closureA stateful counterA one-shot closureCurryingA closure that mutates stateReturning a closureShared vs private captureReturn one of several closuresCompose two subsA list of closures
11Pattern Matching0/20Unlock →
Match specific valuesRegex captures into $1A value or its absenceDestructure a listPull fields from a hashrefOne arm for several valuesMatch a span of valuesDispatch yielding a valueA dispatch tableKeep the ends, skip the middleBranch on success or errorThe /g, /i, and /x flagsA condition on a branchNamed capturess/// with capturestr/// counts and mapsLoop over matchesBranch on list lengthDispatch on ref() typeRecurse into a structure
12Error Handling0/20Unlock →
warn without dyingdie with a newlineeval traps dieeval returns a valuelet errors propagateguaranteed cleanupdie with a hashreffallback on failurekeep only successesnested evaltry / catch featuredie with an objectclassify the errorstop at the first failureadd context and rethrow$SIG{__WARN__} capturetry / catch / finallymatch on error kindlocal $@ for safety$SIG{__DIE__} handler
13Option & Result0/20Unlock →
undef means absencedefined vs falseythe // operatorchain of fallbacksthe //= operatordelete a keyexists on a hashdrop the undefslookup with a defaultarray in scalar contextbranch on presenceerr result pairexists vs definedfirst defined valuedefault in a mapok result pairempty list for nonesafe nested lookupundef vs empty listwantarray context
14Conversions0/15Unlock →
15Collection Conversions0/19Unlock →
16Math0/14Unlock →
17Encoding0/22Unlock →
Bytes to stringString to bytesASCII checks and caseChar to code pointChar digit valueParse a number in a baseBinary, octal, hex formattingBase64 decodeBase64 encodeBig-endian bytesList code pointsEscape control charactersHex encode with sprintfHex with pack and unpackLittle-endian bytesBytes vs charactersROT13UTF-8 encode and decodeCaesar cipherPercent-decodePercent-encodeXOR cipher
18Random0/20Unlock →
Coin flipPick a random elementBuilt-in randRandom float in [0, 1)Weighted true/falseRandom number in a rangeSeed from the clockShuffle with List::UtilRandom alphanumeric stringRandom bytesPassword generatorReproducible sequencesRoll many diceA linear congruential generatorSample k without replacementFisher-Yates shuffleAn xorshift generatorUUID-v4-shaped stringWeighted choiceNormal distribution
19Data I/O0/18Unlock →
Parse CSV into rowsTab-separated valuesBuild a CSV stringSelect one columnCSV into a number matrixSplit off the headerWhitespace-separated matrixSerialize records to CSVSkip blanks and commentsSlurp a file, count rowsPrint an aligned tableWrite a matrix as textStructured dump with Data::DumperParse key=value configRound-trip write then readTiny hand-rolled JSON decoderTiny hand-rolled JSON encoderDrop unparseable rows
20Linear Algebra0/21Unlock →
Matrix shapeScalar multiplyA matrix of zerosElementwise addArgmax of a vectorIdentity matrixOne-hot encodeTraceStack rows (vstack)ReLU and sigmoidApply a function elementwiseColumn meansColumn sumsCosine similarityFlat storage, 2D indexingMatrix times vectorTransposeMatrix multiplyMin-max normalize columnsSoftmaxStandardize columns (z-score)
21Text Processing0/16Unlock →
22Date & Time0/12Unlock →
23Memory0/12Unlock →
24Modules0/20Unlock →
A packageConstants in a packageMany packages in one fileNested namespacesPrivate by conventionBEGIN blockA blessed objectour vs my__PACKAGE__Fully-qualified variableA small utility packagePrivate field, public getterAlias a subIntrospect with isa and canOpt-in exportsExport with ExporterInheritance with @ISARe-export a subrequire at runtimePeek at the symbol table
25Macros0/20Unlock →
Hand-rolled assertionsConcatenate literalsThe constant pragmaThe repetition operatorPrint to STDERRAn array-ref builderA dbg() helperDispatch on a valueMatch against a patternA one-arg prototypeVariadic args via @_Count argumentsA map buildersprintf specifiersStringify a coderefA block prototypeA recursive subGenerate a sub with evalAUTOLOAD and can()Symbol-table codegen
26Testing0/20Unlock →
ok() on a booleanA TAP-style harnessisnt()Testing string outputMultiple assertionsA truth tabledies_ok()POD plus a testTesting an error pathA shared setup helperTesting a methodTesting defined vs undefTesting a die pathTesting internal subsTesting undef-on-failureSkipping a testis_deeply()Comparing floatslike() on a die messageTable-driven tests
27Algorithms0/8Unlock →
28Sorting Algorithms0/12Unlock →
29Expression Parsing0/6Unlock →
30Idioms0/9Unlock →
31OOP & Traits0/8Unlock →
32Trait Objects0/14Unlock →
Return one of several typesInherited base methodTake any blessed objectAn array of coderefsOne iterator vs manyTwo names, one objectSum area over mixed objectsDirect call vs can()Base and derived methodsAn array of objectsRecover the concrete typeWrap a borrowed refRequire a method with can()A handler registry
33Design Patterns0/14Unlock →
35File I/O0/6Unlock →
36Filesystem0/18Unlock →
Does a path exist?Build a pathCopy a fileChange the extensionFiles vs directoriesCreate nested directoriesList a directoryRename or movePath componentsRemove a whole treeSorted listingFile size via statA scratch directoryAbsolute pathFilter by extensionWalk the treeLast modified timeTotal size of a tree
37Networking0/16Unlock →
38Concurrency0/7Unlock →
39Unsafe & FFI0/14Unlock →
40Commands0/14Unlock →
41Array0/10Unlock →
43String0/10Unlock →
45Interval0/5Unlock →
46Linked List0/6Unlock →
47Tree0/14Unlock →
Maximum Depth of Binary TreeInvert Binary TreeSame TreeLowest Common Ancestor of a BSTBinary Tree Level Order TraversalSubtree of Another TreeImplement Trie (Prefix Tree)Kth Smallest Element in a BSTValidate Binary Search TreeAdd and Search WordConstruct Binary Tree from Preorder and InorderBinary Tree Maximum Path SumSerialize and Deserialize Binary TreeWord Search II