mr_b has asked for the wisdom of the Perl Monks concerning the following question:

I am receiving input from STDIN. How do I convert the input in $_ to all uppercase characters?

Replies are listed 'Best First'.
Re: Convert lowercase string to uppercase
by cjf-II (Monk) on Nov 29, 2002 at 02:50 UTC
Re: Convert lowercase string to uppercase
by robot_tourist (Hermit) on Nov 29, 2002 at 04:41 UTC

    My first thought was tr/a-z/A-Z/, but perlop will tell you to use uc (which I must confess I didn't know existed).

    How can you feel when you're made of steel? I am made of steel. I am the Robot Tourist. Robot Tourist, by Ten Benson

Re: Convert lowercase string to uppercase
by AltBlue (Chaplain) on Nov 29, 2002 at 17:25 UTC
    if that's all input that you want uppercased, OFC that uc if your friend, as in:
    perl -ne 'print uc' foo_input_file # or perl -pe '$_ = uc' foo_input_file # or even ... perl -pe 's/(.+)/\U$1\E/' foo_input_file
    The last example shows (again) the power of RegExps, easily giving you the (usual) ability to uppercase only some 'wanted' item from the input lines like...
    # capitalize words perl -pe 's/\b(.)/\U$1\E/g' foo_input_file # ...
    --
    AltBlue.