in reply to Formating in print

I know that perl has a module called Term::Readkey that you could probably take advantage of to do whatever it is you're trying to do. I've never really used it before though, so one of the other monks will probably need to expand...or you could try looking it up on CPAN.
For example:
use Term::ReadKey; ReadMode 'cbreak'; # makes each char available as it is typed $key = ReadKey(0); # get the single char # I guess here is where you'd want to print the comma # ReadMode 'normal'; # return mode back to normal

If you want to get the individual coordinates, why not just have the user enter the two values seperated by a comma and then use the split function to get the values into an array. Just a thought.

But anyway, give the Term::ReadKey a look and see if that'll help you out at all. -Eric

Replies are listed 'Best First'.
Re: Re: Formating in print
by Anonymous Monk on Apr 11, 2002 at 02:03 UTC
    hmm... it doesnt print...

    when i used <STDIN> it would show what i was typing. Now it shows nothing even when i print

    heres my new code:

    #!/usr/bin/perl # The distance formula!!! use Term::ReadKey; print "What is the first point? ("; ReadMode 'cbreak'; $x1 = ReadKey (0); print "$x1,"; ReadMode 'cbreak'; $y1 = ReadKey (0); print "$y1)\n"; print "What is the second point? ("; ReadMode 'cbreak'; $x2 = ReadKey (0); print "$x2,"; ReadMode 'cbreak'; $y2 = ReadKey (0); print "$y2)\n";

    im confused with this Term::ReadKey

    STDIN seems much more friendly :P

      I don't really know what to tell you. Like I said, I've never actually had a use for Term::ReadKey, so I've never written any code using it. I just remember reading about and thought it might help. Perhaps one of the other monks can give you some insight. Good luck.
        OK thanks, I'll look around.

        I'll be sure to post when I ger my P.E.R.L.O.C.K. (like my name for it?) done.

        i just need to think of a good mechanism! :-)