Different results Command Line/CGI

2004-02-01 Thread Owen
I have this script stolen and modified from somewhere #!/usr/bin/perl -w use strict; use File::Find; print "Content-type: text/html\n\n"; my $u=shift; my $sizes = 0; # replace this with your absolute path my $path = "/home/$u/"; find (sub {$sizes += -s ;}, $path); print "$sizes\n"; I am log

Re: how to initialize an array of unknown size to 0?

2004-02-01 Thread Jeff 'japhy' Pinyan
On Feb 1, R. Joseph Newton said: >vaishnavi krishnamurthy wrote: > >>Can anyone tell me how I can do the following - all the elements in my >>array of unkown size should be initialised to the value 0 ? > > thanks, >>vaish. > >No. If the array is of uknown size, it is not possible to do *anything*

Re: how to initialize an array of unknown size to 0?

2004-02-01 Thread R. Joseph Newton
vaishnavi krishnamurthy wrote: > Hello, > > Can anyone tell me how I can do the following - all the elements in my array of > unkown size should be initialised to the value 0 ? > > thanks, > vaish. No. If the array is of uknown size, it is not possible to do *anything* to all elements. Theref

Re: how to initialize an array of unknown size to 0?

2004-02-01 Thread R. Joseph Newton
"Charles K. Clarkson" wrote: > vaishnavi krishnamurthy <[EMAIL PROTECTED]> wrote: > > : Can anyone tell me how I can do the following - all the > : elements in my array of unknown size should be initialized > : to the value 0? > > Assuming your array has only one dimension: > > @array = (0

Re: Writing to file

2004-02-01 Thread R. Joseph Newton
Support wrote: > Hi all > I have a little bit of code you may be able to help with. > I load a file into an array with > > foreach $lines(@database_array) { >@edit_array = split(/\:/,$lines); >push(@member_array,[EMAIL PROTECTED]); >$x++; > } #loop > > and then play around with the a

Re: How can be the return value from a subroutine saved in global array

2004-02-01 Thread Robin Sheat
On Sun, Feb 01, 2004 at 10:50:44AM -0800, R. Joseph Newton wrote: > what things really mean than you would have with the extra typing [hint--most > editors have excellent copy-and-paste facilities for moving identifiers around] To extend this a touch, just because of the number of people I've seen

Re: Writing to file

2004-02-01 Thread John W. Krahn
Support wrote: > > Hi all Hello, > I have a little bit of code you may be able to help with. I load a > file into an array with > > foreach $lines(@database_array) { You should limit the scope of $lines to the foreach loop. Does $lines contain multiple lines or just one line? Perhaps you sho

Re: Writing to file

2004-02-01 Thread Jeff 'japhy' Pinyan
On Feb 2, Support said: >foreach $lines(@database_array) { > @edit_array = split(/\:/,$lines); > push(@member_array,[EMAIL PROTECTED]); > $x++; >} #loop First, it doesn't look like you're using 'strict', which means you're not declaring your variables. This is probably going to lead to trou

RE: Writing to file

2004-02-01 Thread Hanson, Rob
> but I can not retrieve the data into $newline with join. Is this bit wrong Yes, it is a little off. > $member_array[$count] This *isn't* an array, it is an *array reference* > [EMAIL PROTECTED] Same with this. Join takes a list of scalars, not a list of references. So you need to dereferen

Writing to file

2004-02-01 Thread Support
Hi all I have a little bit of code you may be able to help with. I load a file into an array with foreach $lines(@database_array) { @edit_array = split(/\:/,$lines); push(@member_array,[EMAIL PROTECTED]); $x++; }   #loop and then pl

Re: I did it!

2004-02-01 Thread R. Joseph Newton
Joel wrote: > I wrote a decent, working program that actually does something semi-usefull!!!> Check it out! You can find the area of a circle with it!>> Joe Great! Welcome to the programmer's world. A couple tips: The name you used for the zip file was better than the one you used for the scr

Re: How can be the return value from a subroutine saved in global array

2004-02-01 Thread R. Joseph Newton
gautam chaurasia wrote: > i tired like this, so it should get list of genes from subroutine gene and > should print all the entries of array. but it gets only a single value. could > someone please tell me where and what am i doing wrong... > > my $twig= new XML::Twig(); > $twig->parsefile( "local

Re: How to tell if subroutine param is filehandle

2004-02-01 Thread Jeff 'japhy' Pinyan
On Feb 1, [EMAIL PROTECTED] said: >Is there a way for a subroutine to tell when it got passed a FILEHANDLE? You could test to see if its ref() returns "GLOB" or "IO::File" or "IO::Handle", etc., but I think it's a nifty idea to do: if (defined fileno($arg)) { # it's an open filehandle }

Re: How can be the return value from a subroutine saved in global array

2004-02-01 Thread R. Joseph Newton
gautam chaurasia wrote: > i tired like this, so it should get list of genes from subroutine gene and > should print all the entries of array. but it gets only a single value. could > someone please tell me where and what am i doing wrong... > > if ($local_name eq $qname) { >

Re: function that reads line numbers?

2004-02-01 Thread Randy W. Sims
On 1/30/2004 9:45 AM, Jeff 'japhy' Pinyan wrote: On Jan 30, Randy W. Sims said: On 01/30/04 03:59, John W. Krahn wrote: "Randy W. Sims" wrote: while (<>) { if ( $start_line .. $end_line ) { That will be true if $start_line is true and false if $start_line is false. The value in $end_line is

Re: I did it!

2004-02-01 Thread Paul Kraus
On Feb 1, 2004, at 11:51 AM, Joel wrote: I wrote a decent, working program that actually does something semi-usefull (areaformula.pl)!!! Check it out! You can find the area of a circle with it! Also, can someone tell me what I did wrong with modifiedarea.pl and what the error (Main::useless use

I did it!

2004-02-01 Thread Joel
I wrote a decent, working program that actually does something semi-usefull (areaformula.pl)!!! Check it out! You can find the area of a circle with it! Also, can someone tell me what I did wrong with modifiedarea.pl and what the error (Main::useless used only once possible typo at...)means

I did it!

2004-02-01 Thread Joel
I wrote a decent, working program that actually does something semi-usefull!!! Check it out! You can find the area of a circle with it!   Joel PIr^2.pl Description: Binary data -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

How can be the return value from a subroutine saved in global array

2004-02-01 Thread gautam chaurasia
i tired like this, so it should get list of genes from subroutine gene and should print all the entries of array. but it gets only a single value. could someone please tell me where and what am i doing wrong... my $twig= new XML::Twig(); $twig->parsefile( "local.xml"); my $gene_list= $twig1->root

How to tell if subroutine param is filehandle

2004-02-01 Thread mcdavis941
Hi, Is there a way for a subroutine to tell when it got passed a FILEHANDLE? Running a quick test suggests a way, which is to check the first char of the result of interpolating the subroutine param as a string. Can anyone say whether this is robust and if not what might be a better approach?

Re: Calling SUPER::constructor in the constructor

2004-02-01 Thread James Edward Gray II
On Feb 1, 2004, at 1:10 AM, R. Joseph Newton wrote: To answer your immediate question, there is a way to call functions of the parent, but with another step in indeirection: $child_class->SUPER->new. You should rarely need this though. Any attributes [ie hash members] of the parent class that

Re: How to put a variable value into a text file

2004-02-01 Thread Jan Eden
R. Joseph Newton wrote: >Jan Eden wrote: > >>Hi Stuart, >> >>@testarray gets the content of testmessage.txt, which contains the >>string '$name'. You cannot manipulate this string by setting the >>variable $name. You could do: >> >>@testarray =~ s/\$name/$name/g; >> >>which will replace the liter

Re: Perl Style

2004-02-01 Thread Robert
Jeff 'Japhy' Pinyan wrote: On Jan 31, Robert said: When they say "uncuddled else" are they meaning: A cuddled else is: if (...) { ... } else { ... } Anything other than THAT is an uncuddled else. Got it. Thanks! -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional comman

Re: understanding code

2004-02-01 Thread MAC OS X
On 31 Jan 2004, at 21:40, John W. Krahn wrote: Jan Eden wrote: Nilay Puri, Noida wrote: Can any one walk me thru this piece of code :: while() { chomp ; $isbn =(split(/^_/, $_))[0] ; --- not able to understand what is being accessed (..)[0] That's the first element of the array returne

Re: function that reads line numbers?

2004-02-01 Thread MAC OS X
On 28 Jan 2004, at 04:22, Randy W. Sims wrote: On 1/27/2004 9:55 PM, Trina Espinoza wrote: So this may be wishful thinking, but I would be kicking myself later if I didn't ask. Is there a function in perl where you give the function exact line numbers and it would only read the data in the ran

Re: Calling SUPER::constructor in the constructor

2004-02-01 Thread R. Joseph Newton
Dan Anderson wrote: > Is it possible to call the constructor that a function inherits from its > parent? I tried calling SUPER:: and SUPER-> in a constructor and got > errors. Am i correct in assuming that if I rewrite the constructor that > a copy of the parent object won't be available? If yo