Daredevil Δημοσ. 25 Οκτωβρίου 2004 Δημοσ. 25 Οκτωβρίου 2004 re paidia kaneis 3erei apo perl kai cgi scriptakai psaxnw dyo scriptakia pou to ena 8a diabazei ta lines apo ena txt file kai to allo 8a mporei na sbhsei kapoia apo ayta. opoios mporei na boh8hsei einai welcome
alkisg Δημοσ. 25 Οκτωβρίου 2004 Δημοσ. 25 Οκτωβρίου 2004 Γίνε ποιο συγκεκριμένος, αυτό που λες σε perl είναι δύο γραμμές. Η μία γραμμή είναι για να διαβάζει το αρχείο και να το βάζει σε assossiative array και η άλλη εφαρμόζει πάνω του ένα regular expression για να σβήσει ό,τι θέλεις. ΤΙ όμως?
Daredevil Δημοσ. 25 Οκτωβρίου 2004 Μέλος Δημοσ. 25 Οκτωβρίου 2004 tnx for ur reply katarxhn loipon exw ena cgi to opoio pernei ta e3eis stoixeia apo mia html forma, name ,age,email kai gender(apo mia lista). kai ta apo8hkeyei se ena txt arxeio(log.txt) se ayto to format $name\t$Age\t$email\t$D1\n". 8elw loipon ena cgi na kanw access ayto to arxeio kai na mou deixnei ta apotelesmata se ena html arxeio apo to opoio 8a epilegw poia seira dedomenwn na sbhsw.
baxter Δημοσ. 26 Οκτωβρίου 2004 Δημοσ. 26 Οκτωβρίου 2004 hreiazesai 2 cgi, apo to ena tha vlepeis ta periehomena tou log.txt kai to allo tha diagrafei to entry pou thes.. inview.txt > #!/usr/bin/perl open(F,"log.txt"); print "Content-type: text/html\n\n"; $y=-1; while ($x=<F>) { $y++; chomp($x); my @arr = split(/\t/,$x); print "$y. $arr[0] --- $arr[1] --- $arr[2] --- $arr[3] --- [<a href=\"indelete.cgi?entry=$y\">delete</a>] <br>"; } close(F); indelete.cgi > #!/usr/bin/perl use CGI qw/:standard/; $entry = param('entry'); if ($entry !~ /^[0-9]+$/) { print "Content-type: text/html\n\nEntry must be a positive number..."; exit; } open(F,"log.txt"); @arr = <F>; close(F); open(F,">log.txt"); for($x=0;$x<$entry;$x++) { print F "$arr[$x]"; } for($x=$entry+1;$x<=$#arr;$x++) { print F "$arr[$x]"; } close(F); print "Location: inview.cgi\n\n"; ean to log.txt periehei paaaara polla stoiheia mesa tote kalitera sto indelete.cgi na hrisimopoiiseis ena temporary arheio opou tha apothikeveis ena ena ta stoiheia adi na apothikevei olo ta arheio se ena array opws to ehw kanei sto indelete.cgi.. episis kalo einai na pernas ws parametro sto indelete.cgi ena password kai mesa na kaneis ena test etsi wste na ehoun prosvasi mono aftoi pou xeroun to password.
Daredevil Δημοσ. 26 Οκτωβρίου 2004 Μέλος Δημοσ. 26 Οκτωβρίου 2004 oxi ok doulepse mia xara aplws gia na doulepsei ston apachee server eida oti eprepe na balw #!/usr/bin/perl -w, na rwthsw ti shmainei ayto to switch?
Billman Δημοσ. 26 Οκτωβρίου 2004 Δημοσ. 26 Οκτωβρίου 2004 Mercy... RTFM. -w prints warnings about identifiers that are mentioned only once, and scalar variables that are used before being set. Also warns about redefined subroutines, and references to undefined filehandles or filehandles opened readonly that you are attempting to write on. Also warns you if you use == on values that don't look like numbers, and if your subroutines recurse more than 100 deep.
Προτεινόμενες αναρτήσεις
Αρχειοθετημένο
Αυτό το θέμα έχει αρχειοθετηθεί και είναι κλειστό για περαιτέρω απαντήσεις.