How to Read Text Input From DOSBox With Perl

Reading text input is very simple to do with the Perl programming language. If, however, you do not have Perl installed on your computer, then you can use another program. DOSBox is a MS-DOS emulation program. DOS has an inbuilt Perl reader and text editor, and therefore you can create a Perl script in it. In the Perl script, you can set up an input selection and run the Perl script within DOSBox, and then any code passed to it will work.

Instructions

    • 1

      Open DOSBox. Type "PEDIT" and press "Enter" to open the DOS editor.

    • 2

      Type the following example script:
      #! /usr/bin/perl
      print "What's your favorite number?"
      $fave = <>;
      print "Wow $fave is your favorite number:";

    • 3

      Click to exit and save the file, naming it "test.pl" or something similar.

    • 4

      Type "test.pl" and press "Enter" to run the script. It will prompt "What's your favorite number?" At this point, type in your favorite number and press "Enter." This then passes that text input, typed into DOSBox, into Perl.

Related Searches:

References

Comments

Related Ads

Featured