Uppercase word in PERL

how do i print uppercase words in a string in PERL
For example
$str=" welcome to UNIX programming"
should print UNIX

$str="WELCOME to unix programming"
should print WELCOME

i itried the following
/[.!?"]\s+[A-Z]\w+\b/ $str

Can u help me in to get a uppercase word in PERL

Hint:

#!/usr/bin/perl
use strict;
use warnings;

my $str1 = "welcome to UNIX programming";
my $str2 = "WELCOME to unix programming";

$str1 =~ /([A-Z]+)/;
print "$1\n";
$str2 =~ /([A-Z]+)/;
print "$1\n";

Thanks fot the solution...
if the string is
D fm_mtx_cust_check_IMSI - PCM_OP_SEARCH output Function:
the above code is returning only PCM and not PCM_OP_SEARCH.
Any clue?

The character sequence [A-Z] encloses all valid characters. If you need more than just A-Z, add them to it.