LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
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 11-15-2001, 08:27 AM   #1
format_c
LQ Newbie
 
Registered: Oct 2001
Posts: 3

Rep: Reputation: 0
Question Perl>>working with strings


Hi I have a little problem.
Is there a command that can transform a string into Numbers (binary code)?

Like

$string="Test"
$stringnew=unknowncommand ($string)
print $stringnew

Result: 11100011110010001111000110101100101
or 124564534785536

Is there any command which can do this???

How is that syntax???

Please help.




http://www.toxicarea.de/creed/images/banner_gr.jpg CREED for EVER
 
Old 11-15-2001, 01:35 PM   #2
malakai6276
LQ Newbie
 
Registered: Sep 2001
Location: NJ
Distribution: Mandrake 8.1
Posts: 5

Rep: Reputation: 0
Question

Well, you could always write your own method to accomplish this [duh...]. Otherwise... if i remember correctly, i think the "Wolf book" has some information about string manipulations using bit operations via perl code. I think the title is "mastering algorithms with perl", a great book btw. Go to borders or barnes&nobles or some other book store with an extensive CS section, they should have it ...
 
Old 11-15-2001, 04:21 PM   #3
mikeb
LQ Newbie
 
Registered: Sep 2001
Distribution: RedHat
Posts: 1

Rep: Reputation: 0
numbers to binary

try
printf "%b", 12;
for binary of 12 = 1100
and
printf "%vb", 12;
for binary of 1 and 2 = 110001.110010
or
printf "%vb", "test";
for binary of t.e.s.t = 1110100.1100101.1110011.1110100

Last edited by mikeb; 11-15-2001 at 04:26 PM.
 
  


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
how to find duplicate strings in vertical column of strings markhod Programming 7 11-02-2005 04:04 AM
guidlines on working with strings in C? zero79 Programming 1 02-22-2005 03:54 PM
Perl: Ord() with strings KneeLess Programming 1 09-05-2004 03:59 PM
perl not working again!!! dsgdevil Linux - Software 19 07-15-2003 06:45 PM
cant get perl working dsgdevil Linux - Software 2 02-12-2003 08:18 PM


All times are GMT -5. The time now is 07:46 AM.

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