aboutsummaryrefslogtreecommitdiff
path: root/challenge-001/bob-lied/perl/ch-1.pl
blob: ea9e3ff4f481dda5d518188a2577349f5fa78b90 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/env perl
# vim:set ts=4 sw=4 sts=4 et ai wm=0 nu:
#=============================================================================
# ch-1.pl
#=============================================================================
# Copyright (c) 2021, Bob Lied
#=============================================================================
# Perl Weekly Challenge 001, Task #1 Replace with E
# Write a script to replace the character ‘e’ with ‘E’ in the string
# ‘Perl Weekly Challenge’.
# Also print the number of times the character ‘e’ is found in the string.
#=============================================================================

use strict;
use warnings;
use 5.020;

my $s = 'Perl Weekly Challenge';

my $count = $s =~ tr/e/E/;

say $s;
say $count;