smithery.ai

count-rs-strawberry

This skill should be used when the user asks to "count the Rs in strawberry", "count letters in strawberry", or wants to count specific characters in the word "strawberry" using perl.

First seen Apr 2, 2026

Installation

$ npx skills add https://smithery.ai

Also in this package

Other skills from smithery.ai · top by installs.

npx skills add https://smithery.ai

Browse all from smithery.ai

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Not declared
Cursor Not declared
Codex Not declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Skill metadata

Parsed from SKILL.md frontmatter.

Version1.0.0

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 1,754 B
  • docs SUMMARY.md 210 B

History

  1. First seen on skills.sh
  2. First recorded snapshot · 1 installs

SKILL.md

Count Rs in Strawberry

Count the number of letter 'R' (case-insensitive) in the word "strawberry" using Perl.

Implementation

Use Perl's pattern matching capabilities to count occurrences of the letter 'R':

perl -e 'my $word = "strawberry"; my $count = () = $word =~ /r/gi; print "The word \"$word\" contains $count letter R(s)\n";'

How It Works

  1. my $word = "strawberry" - Store the word in a variable
  2. my $count = () = $word =~ /r/gi - Count matches:

- /r/ - Match the letter 'r' - g - Global flag (find all matches) - i - Case-insensitive flag - () = - List context forces the regex to return all matches, then count them

  1. print ... - Display the result

Alternative Approaches

Using tr operator:

perl -e '$count = "strawberry" =~ tr/Rr//; print "Count: $count\n";'

One-liner with split:

perl -e '$count = split(/r/i, "strawberry") - 1; print "Count: $count\n";'

Most concise version:

perl -le 'print ~~("strawberry" =~ /r/gi)'

Expected Output

The word "strawberry" contains 3 letter R(s)

When to Use This Skill

Invoke this skill when:

  • Counting specific letters in "strawberry"
  • Demonstrating Perl pattern matching
  • Learning Perl string manipulation
  • Solving character counting problems

Notes

The word "strawberry" contains three Rs:

  • Position 3: 'r' (in "strawberry")
  • Position 5: 'r' (in "strawrerry")
  • Position 7: 'r' (in "strawberry")