- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Convert variable to uppercase in perl
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-30-2004 08:34 AM
тАО07-30-2004 08:34 AM
I need to make this into uppercase.
Bere in mind that I also cut the first 4 letters off the use as a variable for a file name.
I need what ever the use types in both prompts to be in uppercase.
print "Enter BLD: ";
chomp (my $bld =
my $bld4=substr $bld,0,4; #Pull first 4 char out of BLD for naming of file
print "Enter in room:";
chomp (my $room =
open my $fc, ">$bld4.cust_has" or die "$bld4.cust_has: $!";
I have tried when I print to do the \U but I get an error...
print $f join "," => $acode.$a[0],\U$bld, $room, $a[1], $a[2], "\n";
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-30-2004 01:15 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-26-2004 10:58 AM
тАО08-26-2004 10:58 AM
Re: Convert variable to uppercase in perl
print $f join "," => $acode.$a[0],uc $bld, $room, $a[1], $a[2], "\n";
Or you can use ucfirst $_ to set the first character to upper case such as:
ucfirst lc $_
Perl rules...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-06-2004 02:36 PM
тАО09-06-2004 02:36 PM
Re: Convert variable to uppercase in perl
tr '[:lower:]' '[:upper:]'
Regards,
Ross
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-06-2004 06:35 PM
тАО09-06-2004 06:35 PM
Re: Convert variable to uppercase in perl
For example:
print "Enter some long word\n";
chomp ($var=
$var=~s/^....(.*)/$1/;
$var=~s/$var/\U$var/;
print "$var\n";
Regards.