Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can $\ Input Separator be changed in the middle of reading file ? 1

Status
Not open for further replies.
Sure. But $\ isn't the input separator. I ran a couple of tests and got some strange results when changing the input character. How did your tests turn out?
 
Ah ha - figured out the 'strangeness'. I effectively had a <STDIN> statement in my test program (ie. "Press return to continue" type code) and I absentmindedly was trying to indeed hit the return key to keep going. Since I'd changed $/ I also had to add the new character string into the prompt before it would recognize it.....
 
PinkeyNBrain gets a star from me for sparking my creativity.

Code:
print "Type everything then send EOF.\n\n";
$/ = "\x04";
my $in = <STDIN>;
print "===\nYou said:\n$in\n";
exit(0);

So with that I was able to type as much as I wanted and hit enter and everything, and it wouldn't return to $in until I hit Ctrl-D (or Ctrl-Z if this was a DOS-like system).

Code:
[kirsle@firefly ~]$ perl test4
Type everything then send EOF.

Little Miss Muffet sat on her tuffet
In a nonchalant sort of way.
With her forcefield around her,
The Spider, the bounder,
Is not in the picture today.
===
You said:
Little Miss Muffet sat on her tuffet
In a nonchalant sort of way.
With her forcefield around her,
The Spider, the bounder,
Is not in the picture today.

Cuvou.com | My personal homepage
Code:
perl -e '$|=$i=1;print" oo\n<|>\n_|_";x:sleep$|;print"\b",$i++%2?"/":"_";goto x;'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top