CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner: [SOLVED] 2 beginner questions: Edit Log



HaHaMan
New User

Aug 16, 2012, 9:26 AM


Views: 1417
[SOLVED] 2 beginner questions

First of all, sorry for my english ;)

I got two questions:

1) I have a variable which contains a hexadecimal number, for example:
3e5c4685da

I want to print it as '3e 5c 46 85 da'. In other words, to use a space separator every two hexadecimal numbers. How can I do that?




2) I was trying to use Regular Expressions but I still get a null variable. I got a string like this:
'%SystemDrive%\Documents and Settings\XXXXX'

I want to save the 'XXXXX' in a variable, and I know that is always after the last backslash (\).

I tried this:

Code
$owner = %SystemDrive%\Documents and Settings\LocalService; 
$owner =~ tr/[\\.*$]//;


But when I print it, $owner contains no data. Any solution?



Thanks!!


(This post was edited by HaHaMan on Aug 16, 2012, 12:35 PM)


Edit Log:
Post edited by HaHaMan (New User) on Aug 16, 2012, 9:27 AM
Post edited by HaHaMan (New User) on Aug 16, 2012, 12:35 PM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives