Re: Assigning a singe value to a list

2003-07-18 Thread Janek Schleicher
Paul D. Kraus wrote at Thu, 17 Jul 2003 15:33:11 -0400: > Is there a way to assign a single value to a list? other then doing the > obvious and spelling out each list assignment or running through a loop. > > For instance... > > my ( $var1, $var2, $var3, ... ) = "Paul" > assigning paul to all va

Re: Is there a simple way to include source code I've written in other files?

2003-07-18 Thread Janek Schleicher
Jamie Risk wrote at Thu, 17 Jul 2003 10:39:56 -0400: > Until now, I've avoided writing modules by inlining the deisred code in the > new files. Messy. I'm avoiding modules for two reasons, laziness and naive > conception that for what I'm trying to do it's overkill. > > Is there a method to refe

Re: Regular Expression (fwd)

2003-07-18 Thread Janek Schleicher
Trensett wrote at Wed, 16 Jul 2003 18:29:51 -0500: >> The next will work: >> my @variable = $string =~ /\((.*?)\)/g; > > what's the exact implication of ".*?"? > Why wouldn't just .* in parenthesis work for this case? A good answer can also be found in perldoc perlre and perldoc -q greedy Gree

Re: Assigning a singe value to a list

2003-07-18 Thread Rob Dixon
Janek Schleicher wrote: > Paul D. Kraus wrote at Thu, 17 Jul 2003 15:33:11 -0400: > > > Is there a way to assign a single value to a list? other then > > doing the obvious and spelling out each list assignment or > > running through a loop. > > > > For instance... > > > > my ( $var1, $var2, $var3,

Re: File uploading

2003-07-18 Thread Ramon Chavez
Hello. CGI.pm module can restrict the size of the file being uploaded. You canb use something like this: my $max_size = 512000; #For 500kb limit $CGI::POST_MAX=$max_size; If the file size is bigger than that, it stop the process and returns an error message. But, thinking about it now, it's b

Re: File uploading

2003-07-18 Thread Ramon Chavez
Hello. CGI.pm module can restrict the size of the file being uploaded. You canb use something like this: my $max_size = 512000; #For 500kb limit $CGI::POST_MAX=$max_size; If the file size is bigger than that, it stop the process and returns an error message. But, thinking about it now, it's b

Short silly question

2003-07-18 Thread Gabor Urban
Hi, could someone give me a quick info whar __END__ and __DATA__ lines are good for? Gabaux -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Short silly question

2003-07-18 Thread Rob Dixon
Gabor Urban wrote: > Hi, > > > could someone give me a quick info whar __END__ and __DATA__ lines > are good for? > Short silly answer: __END__ing the program and starting the __DATA__ that you can read from the implicit filehandle. Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For add

How to call / push an elem to a hash of array ?

2003-07-18 Thread LI NGOK LAM
my (%LIST, @other_list); @other_list = ( Unknown Length Data Elems ); foreach my $col (@lists) { for (@other_list) { if ( exist $LIST{$col}[0] ) { Do_smth_2 } # But ERROR either What should I write here ? So can push vars to $LIST{$col} } } Thanks in advi

Re: Simple process controll question

2003-07-18 Thread Ming Deng
Ramprasad wrote: else Instead in your main program call do "foo.pl args..." And in foo.pl set some scope defined variable like #foo.pl $dbh=connect() unless($dbh){ $GLOBAL::ERRORSTR="Couldnot connect to database $@"; exit 1 } And in the main program you can check if($GLOBAL::ERRORSTR) {

Re: custom return value from entire script

2003-07-18 Thread Paul Archer
> Anyone know if it's possible for the return/exit value of a script, in the > event of success, to be something other than 0? > The 'exit' command should work just like it does in the shell: 'exit 9;' for example, *should* give you an exit status of 9 (although I couldn't get it to work for me a m

Re: fast match count of char in string

2003-07-18 Thread Paul Archer
Here's a quick way: perl -e '$var="abdaatela"; print ((scalar grep /a/,(split /(.)/,$var)),"\n");' grep returns the number of matches in a scalar context, and the split breaks the string up into separate elements. The parens in the split return the item split on (otherwise it would throw away each

Re: fast match count of char in string

2003-07-18 Thread Steve Grazzini
On Fri, Jul 18, 2003 at 01:15:15PM -0500, Paul Archer wrote: > Here's a quick way: > perl -e '$var="abdaatela"; print ((scalar grep /a/,(split /(.)/,$var)),"\n");' > > grep returns the number of matches in a scalar context, and the split breaks > the string up into separate elements. The parens in

Re: How to call / push an elem to a hash of array ?

2003-07-18 Thread Zeus Odin
What are you trying to do? If you could include a brief example, it would be nice. Li Ngok Lam wrote: > my (%LIST, @other_list); > > @other_list = ( Unknown Length Data Elems ); > > foreach my $col (@lists) > { > for (@other_list) > { > if ( exist $LIST{$col}[0] ) { Do_smth_2 }

Re: Newbie help

2003-07-18 Thread Jostein Berntsen
On 17.07.03,14:51, Keith Olmstead wrote: > Hello, > > Been searching though this list for awhile now, and now I am needing some help. I > am not asking for someone to do my code for me, I am trying to learn perl and the > only way for me to do that is to dive staight into it. > > My problem i

Regex extraction skipping lines

2003-07-18 Thread Andrew Thomas
Anyone have any ideas about this - is there a common mistake I might be making here? I am using a simple regex to extract a few pieces of every line of a 2000+ line text file then spitting it back into a second text file. I can't figure out why but the output file always includes every other li

Re: Regex extraction skipping lines

2003-07-18 Thread Rob Dixon
Andrew Thomas wrote: > Anyone have any ideas about this - is there a common mistake I > might be making here? > > I am using a simple regex to extract a few pieces of every line of > a 2000+ line text file then spitting it back into a second text > file. I can't figure out why but the output file a

RE: Regex extraction skipping lines

2003-07-18 Thread Mark Anderson
> Anyone have any ideas about this - is there a common mistake I might be > making here? > > I am using a simple regex to extract a few pieces of every line of a 2000+ > line text file then spitting it back into a second text file. I can't figure > out why but the output file always includes every

Re: How to call / push an elem to a hash of array ?

2003-07-18 Thread John W. Krahn
Li Ngok Lam wrote: > > my (%LIST, @other_list); > > @other_list = ( Unknown Length Data Elems ); > > foreach my $col (@lists) > { > for (@other_list) > { > if ( exist $LIST{$col}[0] ) { Do_smth_2 } # But ERROR either If you want to test if the array has any elements you can do

Re: chomp'ing EOL

2003-07-18 Thread Wiggins d'Anconia
Jamie Risk wrote: I've no control over the EOL of text files that I'm processing; is there a conveniant method using chomp() and the INPUT_RECORD_SEPERATOR ($/) to handle DOS/UNIX/MAC generated text files automatically? Handle them how? http://danconia.org -- To unsubscribe, e-mail: [EMAIL PROTEC

php mod perl 5.8 apache2 question

2003-07-18 Thread Motherofperls
Hi all, I have downloaded and installed perl with apache and php Here are the readme file folders for each part of the packaged file Perl-5.8-win32-bin-0.1.exe openssl-0.9.6h php-4.23 mod_perl-2.0 httpd-2.0.43 AP804_source I have apache running ok and perl, but I can't get the hello world fil

Re: Simple process controll question

2003-07-18 Thread Ramprasad A Padmanabhan
On Fri, 2003-07-18 at 22:34, Ming Deng wrote: > Ramprasad wrote: > > > else > > Instead in your main program call > > do "foo.pl args..." > > > > And in foo.pl set some scope defined variable like > > > > #foo.pl > > $dbh=connect() > > unless($dbh){ > > $GLOBAL::ERRORSTR="Couldnot connect