Skip to content
Back to skills

Count Rs Strawberry

ASecurity

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.

  • 57 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added October 17, 2026
tools

Security analysis

A100/100

Scanned October 17, 2026

npx -y skills add diegosouzapw/awesome-omni-skill --skill count-rs-strawberry --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Count Rs Strawberry?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Count Rs Strawberry
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/diegosouzapw-count-rs-strawberry/badge)](https://www.skillsdirectory.com/skills/diegosouzapw-count-rs-strawberry)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: count-rs-strawberry
description: 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.
version: 1.0.0
---

# 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
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
3. **`print ...`** - Display the result

## Alternative Approaches

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

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

### Most concise version:
```perl
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 "st**r**awberry")
- Position 5: 'r' (in "straw**r**erry")
- Position 7: 'r' (in "strawbe**r**ry")

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.