Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Re: reverse interpolation

by parv (Priest)
on Sep 17, 2008 at 06:31 UTC ( #711887=note: print w/replies, xml ) Need Help??

in reply to reverse interpolation

Is that a trick question? By using a look up table aka hash...

my %map = ( "\t" => '\t' ); my $y = "\t"; print $map{ $y };

See also Re^3: Generating characters (0 to 255).

After skimming referenced post ... Removed unnecessary chr ord functions.

Replies are listed 'Best First'.
Re^2: reverse interpolation
by Erez (Priest) on Sep 17, 2008 at 07:09 UTC

    Is that a trick question?

    Seeing as the title is "reverse interpolation", the OP probably wondered whether there is some way to have perl magically understand that if $foo = "bar", then print "bar" could actually print '$foo'...

    Seeing as it isn't, a more sensible approach emerged.

    Stop saying 'script'. Stop saying 'line-noise'.
    We have nothing to lose but our metaphors.

Re^2: reverse interpolation
by gleeco (Novice) on Sep 17, 2008 at 06:53 UTC
    so obvious i'm obviously not... but why the trouble with chr ord when it works without? thanks!

      You missed the update by a few seconds! You are right that chr ord chain was unnecessary (I started by finding the number to represent a tab, which I changed to use "ord", which changed to just the interpolated string).

      Obviously, I should have just started & ended with plain tab ... as you wrote "so obvious i'm obviously not". :}

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://711887]
choroba waves in
Corion has to work on his mood today.
[Corion]: I have to write at least one not so nice mail, give a stern word to some colleagues who took changes into production without getting approval and actually get some work done...
[choroba]: too busy to work on my mood :-(
choroba having "blue pipeline duty" this week
[Corion]: choroba: Exactly that, but I prefer to keep an eye on my mood nowadays...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (6)
As of 2017-03-29 07:29 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (344 votes). Check out past polls.