customizing eof chatacter

2007-08-05 Thread Jorge Almeida
Is there some variable that will do for a file what $/ does for a record? What I mean is that in $s= the value of $s depends on the value of $/, but in @arr= I couldn't find a way to force the reading to stop when some character is found. Note that reading STDIN line by line and ch

Re: customizing eof chatacter

2007-08-05 Thread Mumia W.
On 08/05/2007 07:21 AM, Jorge Almeida wrote: Is there some variable that will do for a file what $/ does for a record? What I mean is that in $s= the value of $s depends on the value of $/, but in @arr= I couldn't find a way to force the reading to stop when some character is found. Note

Re: customizing eof chatacter

2007-08-05 Thread Ken Foskey
On Sun, 2007-08-05 at 13:21 +0100, Jorge Almeida wrote: > Is there some variable that will do for a file what $/ does for a > record? > What I mean is that in > $s= > the value of $s depends on the value of $/, but in > @arr= You mention EOF and you mean EOL (end of line). Since you k

Re: customizing eof chatacter

2007-08-05 Thread John W. Krahn
Jorge Almeida wrote: Is there some variable that will do for a file what $/ does for a record? What I mean is that in $s= the value of $s depends on the value of $/, but in @arr= I couldn't find a way to force the reading to stop when some character is found. There is no "eof" character

Re: customizing eof chatacter

2007-08-05 Thread Jorge Almeida
On Sun, 5 Aug 2007, Mumia W. wrote: On 08/05/2007 07:21 AM, Jorge Almeida wrote: open(F,"do-something|"); while(){...} and later open(G,"do-something-else|") while(){...} What do F and G have to do with STDIN? Everything... The code "while(){...}" does not read from ST

Re: customizing eof chatacter

2007-08-05 Thread Jorge Almeida
On Sun, 5 Aug 2007, John W. Krahn wrote: Jorge Almeida wrote: Is there some variable that will do for a file what $/ does for a record? Note that reading STDIN line by line and checking for a character won't do the job, because somewhere in the program I need something like open(F

Re: customizing eof chatacter

2007-08-05 Thread Mr. Shawn H. Corey
Jorge Almeida wrote: OK, I suppose there is no way to do it... I have an interactive, shell-like, program. Some commands read a line from STDIN, or the whole STDIN (meaning until CTRL-D is pressed). Now I want to modify the program to have a batch mode. Commands would be read from STDIN (probabl

Re: customizing eof chatacter

2007-08-05 Thread Jorge Almeida
On Sun, 5 Aug 2007, Mr. Shawn H. Corey wrote: How big are these files? Could you read everything at once? If it's They're small enough to be slurped. The problem is that the chunk for a particular command may need to be passed to the shell for processing before being used by the Perl progra

Re: customizing eof chatacter

2007-08-05 Thread Mr. Shawn H. Corey
Jorge Almeida wrote: They're small enough to be slurped. The problem is that the chunk for a particular command may need to be passed to the shell for processing before being used by the Perl program. Something like this: 1my @all=; 2my @chunk=(); 3for (@all

Re: customizing eof chatacter

2007-08-05 Thread Jorge Almeida
On Sun, 5 Aug 2007, Mr. Shawn H. Corey wrote: See `perldoc perlfaq8` and search for "How can I open a pipe both to and from a command?" Thank you. I'll have to decide whether using IPC::Open2 is safe enough... -- Jorge Almeida -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional com

Re: customizing eof chatacter

2007-08-06 Thread Ken Foskey
On Sun, 2007-08-05 at 18:26 +0100, Jorge Almeida wrote: > I have an interactive, shell-like, program. Some commands read a line > from STDIN, or the whole STDIN (meaning until CTRL-D is pressed). Now I > want to modify the program to have a batch mode. Commands would be read > from STDIN (probably

Re: customizing eof chatacter

2007-08-06 Thread Jorge Almeida
On Mon, 6 Aug 2007, Ken Foskey wrote: On Sun, 2007-08-05 at 18:26 +0100, Jorge Almeida wrote: It sounds like you want something similar to parameter handling, generally this works on escalating files. eg /etc/myprog overridden by ~/.myprog overrridden by a specific options file and so on. T