The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.
#!/usr/local/bin/perl -w

use strict;

my ($VERSION) = '1.2';

if (@ARGV) {
    if ($ARGV [0] eq '--version') {
        $0 =~ s{.*/}{};
        print "$0 (Perl bin utils) $VERSION\n";
        exit;
    }
    if ($ARGV [0] eq '--help') {
        $0 =~ s{.*/}{};
        print <<EOF;
Usage: $0 [OPTION] [STRING [STRING [STRING ... ]]]

Repeatedly print its arguments, or "y".

Options:
       --version:  Print version number, then exit.
       --help:     Print usage, then exit.
       --:         Stop parsing options.
EOF
        exit;
    }
    if ($ARGV [0] eq '--') {
        shift;
        unshift @ARGV, "y" unless @ARGV;
    }
    $_ = "@ARGV\n";
}
else {$_ = "y\n"}

print while 1;

__END__

=pod

=head1 NAME

yes - print out a string till doomsday

=head1 SYNOPSIS

yes [option] [strings]

=head1 DESCRIPTION

I<yes> repeatedly prints out its arguments on standard output, untill killed.
If no strings are given, I<y> is printed.

=head2 OPTIONS

I<yes> accepts the following options:

=over 4

=item --help

Print out a short help message, then exit.

=item --version

Print out its version number, then exit.

=item --

Stop parsing for options. Useful if you want to print out I<--help>
or I<--version>. Use I<yes -- --> to print out I<-->.

=back

=head1 ENVIRONMENT

The working of I<yes> is not influenced by any environment variables.

=head1 BUGS

I<yes> has no known bugs.

=head1 AUTHOR

The Perl implementation of I<yes> was written by Abigail, I<abigail@fnx.com>.

=head1 COPYRIGHT and LICENSE

This program is free and open software. You may use, modify, distribute
and sell this program (and any modified variants) in any way you wish,
provided you do not restrict others to do the same.

=cut