HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: put variable in uppercase in Perl
Operating System - HP-UX
1834902
Members
3597
Online
110071
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
back
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
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
Topic Options
- 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:35 AM
07-30-2004 08:35 AM
Sorry this should have been posted here.
I have a script that prompts a user for input.
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";
I have a script that prompts a user for input.
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.
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2004 08:52 AM
07-30-2004 08:52 AM
Solution
use local;
$beast = "something";
$capit = ucfirst($beast) # capitalizes first character
$capall = uc($beast);
From O'Reilly Perl Cookbook page 19-21
SEP
$beast = "something";
$capit = ucfirst($beast) # capitalizes first character
$capall = uc($beast);
From O'Reilly Perl Cookbook page 19-21
SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2004 08:28 PM
07-30-2004 08:28 PM
Re: put variable in uppercase in Perl
\U is for regular expressions, and uppercased till the end of string or till \E
SEP, it's not 'use local;', but 'use locale;'
print $f join "," => $acode.$a[0],uc$bld, $room, $a[1], $a[2], "\n";
will only uppercase $bld (uc takes one argument only)
print $f uc join "," => $acode.$a[0], $bld, $room, $a[1], $a[2], "\n";
will uppercase the entire line
Enjoy, Have FUN! H.Merijn
SEP, it's not 'use local;', but 'use locale;'
print $f join "," => $acode.$a[0],uc$bld, $room, $a[1], $a[2], "\n";
will only uppercase $bld (uc takes one argument only)
print $f uc join "," => $acode.$a[0], $bld, $room, $a[1], $a[2], "\n";
will uppercase the entire line
Enjoy, Have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP