Last active
August 29, 2015 14:08
-
-
Save paveljurca/5b58a48526fd98a9d733 to your computer and use it in GitHub Desktop.
How many z's? | http://scontent-a-ams.xx.fbcdn.net/hphotos-xpa1/t31.0-8/s720x720/10273096_620113888071224_6504456192424711689_o.png
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$> echo "Zanzibar, zambeZi" | perl -le "@_= <STDIN> =~ m/z/g; print scalar(@_);" | |
$> echo "Zanzibar, zambeZi" | perl -le "print (scalar(split /z/, <STDIN>) - 1);" | |
-- | |
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use feature q{say}; | |
my $z; | |
chomp(my $input = <STDIN>); | |
for (split /\s*/, $input) {$z++ if $_ eq 'z'} | |
say $z; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment