#!/usr/bin/perl -w print "Content-type: text/html\n\n"; #Here I am getting the values from #the GET form. foreach $pair (split('&', $form)) { if ($pair =~ /(.*)=(.*)/) { # found key=value; ($key,$value) = ($1,$2); # get key, value. $value =~ s/\+/ /g; # substitute spaces for + signs. $value =~ s/%(..)/pack('c',hex($1))/eg; $inputs{$key} = $value; # Create Associative Array. } } #This next assigns assigns the values to variables $nombre = $inputs{'nombre'}; $encabezado = $inputs{'encabezado'}; $cat = $inputs{'cat'}; #Now I created this rudimentary statements that by seeing #which category I chose, select which file I am going to #move the link to. if($cat == t){ $catfile = "notitec.html"; } if($cat == a){ $catfile = "notiagro.html"; } if($cat == d){ $catfile = "notideportes.html"; } if($cat == h){ $catfile = "notihogar.html"; } if($cat == r){ $catfile = "notirecrea.html"; } if($cat == s){ $catfile = "notisociales.html"; } #Now I open the current headline and read it to an array #but changing locally the separator character so I don't #get a straight line of html code { $current = "/var/www/html/notidia.html"; open(DIA, "< $current") or die("Couldn't open $current\n"); local $/ = >; @file_data = ; close DIA; } #now open the category file and insert the previous data $catnoticia = "/var/www/html/$catfile"; open(NOT, "> $catnews") or die("Couldn't open $catnews\n"); foreach $line (@file_data) { print "$line"; } close NOT; #that's what I got so far. I think I got the idea right but #didn't express it correctly on the code (duh) #If I have some variable names wrong its because I changed #the names to english or something understandable to you so #you can get a better idea.