<p>The one-liner should:</p>

<ul>
<li>solve a real-world problem</li>
<li>not be extensively cryptic (should be easy to understand and reproduce)</li>
<li>be worth the time it takes to write it (should not be too clever)</li>
</ul>

<p>I'm looking for practical tips and tricks (complementary examples for <code>perldoc perlrun</code>).</p>

The problem
: A media player does not automatically load subtitles due to their names differ from corresponding video files.
Solution
: Rename all *.srt (files with subtitles) to match the *.avi (files with video).
```
```
perl -e'while(<*.avi>) { s/avi$/srt/; rename <*.srt>, $_ }'
```
```
CAVEAT: Sorting order of original video and subtitle filenames should be the same.
Here, a more verbose version of the above one-liner:
```
```
my @avi = glob('*.avi');
my @srt = glob('*.srt');

for my $i (0..$#avi)
{
  my $video_filename = $avi[$i];
  $video_filename =~ s/avi$/srt/;   # 'movie1.avi' -> 'movie1.srt'

  my $subtitle_filename = $srt[$i]; # 'film1.srt'
  rename($subtitle_filename, $video_filename); # 'film1.srt' -> 'movie1.srt'
}
```
```