is there something like a “foreach” mode from the command line? Like in perl?

With perl we can run perl -p . That wraps a foreach loop around the code and executes the code on the file. What I’m looking for is something like


and then I get a new file in which the string replace happened (the above would convert a .tsv to a .csv). Doesn’t have to be StringReplace, can be anything that takes a line of stuff as input. Total[filename] would total all numbers in the rows of the file.

That is like “scripting” the M command line-by-line (during MS-DOS we used to call that “batch mode” — really means line-by-line).

For creating tools, Bash, Perl or Python? Which should I invest my time in to?

Having trouble choosing between the three, I would of course love to learn all three in the future, but right now I’m curious as to which language would be the most beneficial to me.

Also, I’m aware that different tools might be more useful in certain scenarios, in this case, I just want to learn the language that suits best for creating Ethical hacking tools, and which language would be the easiest to master?

Como puedo pasar los datos de mi Formulario html a traves de un script Perl?

estoy comenzando a hacer scripts en perl pero no porque me sale este error: Este es mi formulario en html ya vi los name de cada input, tambien vi la ruta del action que este bien. Y nada sigue apareciendo un error…

<!DOCTYPE HTML> <html> <head> 	<title>Mi FORMULARIO</title> 	<link rel="stylesheet" type="text/css" href="../estilos/estio.css"> </head> <body> 	<form action="../cgi-bin/" method="post"> 		<label for="nombre">Nombres: </label> 		<input  name="nombre" type="text" id="nombre"   placeholder="Escribe tu nombre"> 		<label for="Email">Email</label> 		<input name="apellido" type="text" id="Email" placeholder="Escribe tus apellidos"> 		<label for="mensaje" >Mensaje:</label> 		<textarea name="texto" type="text" id="mensaje" placeholder="Escribe tu mensaje"></textarea> 		<input type="submit" value="Enviar"> 	</form>  </body> </html>

Ahora voy a mostrar el script en perl, es basico…

introducir el código aquí #!usr/bin/perl -wT   use CGI; use strict;  my $  cgi=new CGI;  my $  nombre    = $  cgi ->param("nombre"); my $  apellido  = $  cgi ->param("apellido"); my $  texto     = $  cgi ->param("texto");  my $  cabecera = $  cgi->header(-type => "text/html");    print $  cabecera;    print "<h1>Mucho gusto" .$  nombre .$  apellido."</h1>"."\n";    print "<h1>Gracias por tu comentario</h1>";    print "<a href='../html/MiFORM.html'>Regresar al formulario</a>"; 

Y mi el error que me sale es: Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at webmaster@localhost to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.

Apache/2.4.29 (Ubuntu) Server at Port 80

Cual es mi error?

¿Porque perl no detecta el modulo que he creado?

Como podéis observar en el título, no se porque pero por alguna razón perl no me detecta el modulo que tengo en el mismo directorio donde esta el script, cuando intento abrir el script de perl me dice lo siguiente, “Can’t locate (el nombre del modulo).pm in @INC”, he intentado hacer todo lo que he podido para intentar hacer que me pille el modulo pero no he conseguido nada sigo con el mismo mensaje.

Unable to connect to MySQL database while installing PERL script

I just attempted to install a PERL script on my Godaddy Linux hosting account and I keep getting this message:

install_driver(mysql) failed: Can't locate DBD/ in @inc (@inc contains: Modules . /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5) at (eval 9) line 3.
Perhaps the DBD::mysql perl module hasn't been fully installed,
or perhaps the…

Unable to connect to MySQL database while installing PERL script

Dúvida código em Perl

O seguinte código retornou erro na execução. Alguém saberia me dizer onde está o erro e como corrigi-lo? Desde já, obrigada.

#!/usr/bin/perl  for ($  i=1; $  i<15; $  i = $  i + 1;){     for ($  j=1; $  j<15; $  j = $  j + 1;){         $  multi = $  i * $  j;         print "$  i X $  j = $  multi;\n";         }     } 

Perl добавить чекбоксы в БД

Есть форма с множеством инпутов.

^[@items2 ^[$  name] <input type=checkbox name=acc_^[$  id] ?] > @] 

ID много и заранее прописать каждый я не могу.

Пытаюсь взять отмеченные поля и добавить в БД. Вот так:

foreach my $  acct (param()) {     if ($  acct =~ /^acc_(\d+)$  / ) {                        if (param($  acct) =~ /^\d+$  / && param(&acct)->{selected}) {              my $  sth = $  dbh->prepare("INSERT INTO catalog_chains (cidc, pidc) VALUES (?,?)");              my $  rvs = $  sth->execute($  id, param($  acct)) or &error($  sth->errstr);             }           }     } 

Т.е. беру все с acc*, вытаскиваю оттуда только ID (без acc), проверяю на отмеченность и пытаюсь отмеченные добавить в БД.

Что я делаю не так?

invoke a URL Perl script silently, without changing URL visible to client

I’ve been fighting the Google canonical page algorithm bug for 2+ months. Following various forum advice and suggestions haven’t solved it yet, although for sure they’ve made our website better. One advice I’ve been given is to hide, or make silent, our use of a page generation Perl script (example here), and give Google indexing only “plain URLs” with no script, no page parameters, no file extensions, etc. I don’t know if that fixes it but anything is worth a try when Google indexing goes into lock mode and refuses to index your pages.

My question is: how to start with a URL and end up with the same URL, with Perl script processing in between? I thought about doing it with an .htaccess rewrite, which we already use, for example: –>

but then I would need to rewrite back, and that would be an .htaccess loop. Plus if the URL were given in the first place I would not want the first rewrite.

Any and all suggestions on how to solve this welcome.

This system is currently not set up to build kernel modules. Please install the gcc make perl packages from your distribution

I am trying to Insert Guest Additions CD Image and then run I am new to Ubuntu and trying to learn. I am running Ubuntu 18.04LTS through Oracle VM v6.04r. My host laptop is running Windows 10 Pro. So I went to Devices>Insert Guest Additions CD Image. That created Vbox_GAs_6.0.4 on my Ubuntu Desktop. Then I tried to run through the terminal and go the following messages.

arijitpc@arijitpc-VirtualBox:/media/arijitpc/VBox_GAs_6.0.4$ sudo ./ [sudo] password for arijitpc: Verifying archive integrity… All good. Uncompressing VirtualBox 6.0.4 Guest Additions for Linux…….. VirtualBox Guest Additions installer Removing installed version 6.0.4 of VirtualBox Guest Additions… Copying additional installer modules … Installing additional modules … VirtualBox Guest Additions: Building the VirtualBox Guest Additions kernel modules. This may take a while. VirtualBox Guest Additions: To build modules for other installed kernels, run VirtualBox Guest Additions: /sbin/rcvboxadd quicksetup VirtualBox Guest Additions: Building the modules for kernel 4.18.0-18-generic.

This system is currently not set up to build kernel modules. Please install the gcc make perl packages from your distribution. VirtualBox Guest Additions: Running kernel modules will not be replaced until the system is restarted VirtualBox Guest Additions: Starting. VirtualBox Guest Additions: Building the modules for kernel 4.18.0-18-generic.

This system is currently not set up to build kernel modules. Please install the gcc make perl packages from your distribution.

Request you to please help me as to what should be done. There are so many information out there, most of which are not working, its confusing. Also request to please provide me the commands I need to run on the terminal as I am mostly not familiar with most lingo in Ubuntu/ Linux environment.