For Programmers: Free Programming Magazines  


Home > Archive > PERL CGI Beginners > November 2004 > One line file as an array









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author One line file as an array
J. Alejandro Ceballos Z.

2004-11-26, 3:55 am


I am sending a text file with SQL statements via Form to a CGI.

I am trying to make the file as a one line (and deleting extra spaces too),
to later split them using the ; as delimiters.

The problem is that after the operation, no lines are stored in the array.

Any idea about what is happening?

use CGI;
my $cgi_this = new CGI;
my $str_file = $cgi_this->param('file');
$str_file =~ s/\s+/ /gs;
my @arr_sqlqueries = split (/;/, $str_file);
....


- I hope is not an other B&B (basic and blind) error -



Saludos,


J. Alejandro Ceballos Z. |
-------------------------------+------------------------------
http://alejandro.ceballos.info |
buzon@alejandro.ceballos.info |
|

Gunnar Hjalmarsson

2004-11-26, 3:55 am

J. Alejandro Ceballos Z. wrote:
> I am sending a text file with SQL statements via Form to a CGI.


Are you trying to upload a file, or are you just sending the file
contents as an ordinary parameter?

> I am trying to make the file as a one line (and deleting extra spaces
> too), to later split them using the ; as delimiters.
>
> The problem is that after the operation, no lines are stored in the array.
>
> Any idea about what is happening?
>
> use CGI;
> my $cgi_this = new CGI;
> my $str_file = $cgi_this->param('file');
> $str_file =~ s/\s+/ /gs;
> my @arr_sqlqueries = split (/;/, $str_file);
> ....


Please show us the form.

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com