LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 01-20-2005, 06:05 AM   #1
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: FreeBSD, Debian, Mint, Puppy
Posts: 3,290

Rep: Reputation: 174Reputation: 174
change case in perl?


is there a cooler way than this to uppercase in perl?

Code:
$thing =~ tr/a-z/A-Z/;
 
Old 01-20-2005, 06:48 AM   #2
jkobrien
Member
 
Registered: Jun 2003
Location: Dublin, Ireland
Distribution: Slackware, LFS, Ubuntu, RedHat, Slamd64
Posts: 507

Rep: Reputation: 30
Code:
$thing = "abcdef";
$thing = uc($thing);

# $thing is now "ABCDEF"

$thing = lc($thing);

# now it's back the way it was
John
 
Old 01-20-2005, 07:00 AM   #3
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: FreeBSD, Debian, Mint, Puppy
Posts: 3,290

Original Poster
Rep: Reputation: 174Reputation: 174
Or even ...

Code:
$thing = "\U$thing";
Blimey!
Perl could confuse a stupid person.
 
Old 01-20-2005, 07:08 AM   #4
jkobrien
Member
 
Registered: Jun 2003
Location: Dublin, Ireland
Distribution: Slackware, LFS, Ubuntu, RedHat, Slamd64
Posts: 507

Rep: Reputation: 30
Haha! I didn't read your first post carefully enough. Yes, "\U$thing" is cooler.

J.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
change case of a string (TOUPPER) in shell script raees Linux - Software 3 05-03-2005 02:13 PM
Converting sLoPPy cASE to Pretty Case with tr lowpro2k3 Programming 4 04-13-2005 08:13 PM
Change Case DavidPhillips Programming 6 04-02-2005 04:45 PM
Why are all my upper case files being shown as lower case?? [Kernel 2.6.9-1.667 FC3] t3gah Fedora 4 03-11-2005 04:09 PM
Lower case to upper case letter sudhasmyle Programming 1 12-03-2004 04:15 AM


All times are GMT -5. The time now is 04:21 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration