[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [PROGRAMMERING] [perl] while løkke til variabel



René Seindal wrote:
Magnus Pedersen wrote (05-02-2006 10:47):

Mit eneste problem nu er at komme ud af løkken igen, jeg troede at while løkken ville stoppe hvis jeg gav et tomt input i STDIN, altså bare trykkede Enter nå der spørges om input, men det virker ikke.

Hvordan gør jeg det?


Tast ^D (control-D) der betyder End-of-file.

Men jeg vil ikke til EOF kun ud af løkken:

while ($search = <STDIN>) {


#test løkken virker. print "Vi søger efter $search\n";

chomp $search;

#Brug søgestrengen på @log
@hits = grep {
	/$search/i
	} @log;
print "@hits";

##Sæt @log lig med @hits så vi kun søger i resultaterne
@log = @hits;
print "Hvilket udtryk vil du søge i resultaterne efter? \n";

}
print "SKAL SKRIVES!";

--
"Ford, you're turning into a penguin. Stop it."

Douglas N. Adams (1952-2001)

 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2006-03-01, 02:01 CET [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *