Color theme
0 day streak0 XPP1
PerlLearn mode
MISSION 1 OF 1

Read the route backward

0 XP earned
Perl track: AdvancedMission: IntermediateList contextArray reversalArray slices
Before you start this advanced track

Arrays, hashes, and regular expressions. Expect sigils, capture groups, and scalar/list context.

Guided code reading and debugging. Runnable coding challenges are available in JavaScript, Python, and SQL.

x
0 / 2 challenges
LEARN THE CONCEPT

Understand it, then try it.

An array preserves the order of a route through a building. reverse produces a reversed list when assigned to an array. An array slice then selects its first two entries, using zero-based positions, and join connects those entries with an arrow. The original visits array remains available in its original order.

text_desk.pl
use strict;use warnings;my @visits = ("desk", "studio", "roof", "cafe");my @recent = reverse @visits;my $report = join(" > ", @recent[0, 1]);print "$report\n";

Each mission is a complete Perl 5 script. Run one with perl. The scripts enable strict and warnings and use only built-in features; no modules, files, or external commands are needed.

Track the values line by line. Predict the result before running this example in your own editor.