Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: STDIN Odd Bevahior in Linux Environments

by liverpole (Monsignor)
on Sep 23, 2009 at 21:52 UTC ( [id://797086]=note: print w/replies, xml ) Need Help??


in reply to STDIN Odd Bevahior in Linux Environments

Hi bichonfrise74,

I've not seen that before, but if you try running the script utility (which spawns a new shell, and then records all I/O until you exit the shell, saving it to a specified textfile, or typescript by default), it might give you more clues about what's happening.

For example:

[liverpole@myhost ~]% cat example.pl #!/usr/bin/perl -w use strict; print "Enter: "; my $input = <STDIN>; [liverpole@myhost ~]% script output Script started, file is output liverpole@myhost# ./example.pl Enter: tes liverpole@myhost# exit exit Script done, file is output [liverpole@myhost ~]% cat output Script started on Wed Sep 23 17:46:45 2009 liverpole@myhost# ./example.pl Enter: tes liverpole@myhost# exit exit Script done on Wed Sep 23 17:47:08 2009

In the above example, the backspace key worked as expected, which you can see very clearly when you edit the script file "output", as the line with the backspace is revealed to be:

Enter: test^H ^H^M

Clearly it's doing a backspace, followed by a space (to erase the final 't' of 'text'), followed by another backspace.


s''(q.S:$/9=(T1';s;(..)(..);$..=substr+crypt($1,$2),2,3;eg;print$..$/

Replies are listed 'Best First'.
Re^2: STDIN Odd Bevahior in Linux Environments
by bichonfrise74 (Vicar) on Sep 23, 2009 at 22:28 UTC
    This is what I see when I do cat output...
    Script started on Wed 23 Sep 2009 03:20:17 PM PDT home:~$ perl 33.pl Enter: test^H^Hhello^H^Hm^H home:~$ exit exit Script done on Wed 23 Sep 2009 03:20:29 PM PDT
    This is what I see when I run vi output...
    Script started on Wed 23 Sep 2009 03:20:17 PM PDT ^[]0;home: ~^Ghome:~$ perl 33.pl^M Enter: test^H^Hhello^H^Hm^H^M ^[]0;home: ~^Ghome:~$ exit^M exit^M Script done on Wed 23 Sep 2009 03:20:29 PM PDT
    It looks like only ^M (enter key) is working properly and ^H is not. Hmm... does this mean that this is not a Perl-related problem?

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (2)
As of 2024-04-25 18:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found