PDA

View Full Version : getting input in perl



Tk007LwZFJW5ej
October 31st, 2012, 01:10 AM
Is there a built-in way to get user input word-by-word (rather than line-by-line) from STDIN in perl, or do I have to code that myself?

trent.josephsen
October 31st, 2012, 01:24 AM
You can fiddle with $/ to change the separator <FILEHANDLE> uses, which is a newline by default (careful changing it as it changes for the entire module -- see here (http://www.perlmonks.org/?node_id=287647) for more details), or you can use Perl's read built-in if you want to do it the hard way.