Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^2: Passing Array to Function for search and Replace

by ikkon (Monk)
on Jan 08, 2007 at 18:42 UTC ( #593594=note: print w/ replies, xml ) Need Help??


in reply to Re: Passing Array to Function for search and Replace
in thread Passing Array to Function for search and Replace

I have been trying to looking into the Encode, but was never sucessful, it would not print anything when I tried, since i have to get this working today, I didn't have alot of time to figure it out I spent a few hours on it but still couldn't wrap my mind around it.


Comment on Re^2: Passing Array to Function for search and Replace
Re^3: Passing Array to Function for search and Replace
by ikegami (Pope) on Jan 08, 2007 at 18:50 UTC

    Say you want to convert from UTF-8 to iso-latin-1,

    use Encode qw( decode encode ); ... input ... foreach ($hardwareValue1, $hardwareValue2) { $_ = decode('UTF-8', $_); } ... do some work ... foreach ($hardwareValue1, $hardwareValue2) { $_ = encode('iso-latin-1', $_); } ... output ...

    If you just want to translate,

    use Encode qw( from_to ); ... input ... foreach ($hardwareValue1, $hardwareValue2) { $_ = from_to($_, 'UTF-8', 'iso-latin-1'); } ... output ...

    If a given char doesn't exist in iso-latin-1, you'll get a ? instead.

    Remember, when you read in something, it is encoded. Convert it to characters before working on it. When you need to write something, it needs to be encoded.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://593594]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (3)
As of 2014-08-31 08:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (294 votes), past polls