Re: go to next file

2002-09-12 Thread david
Harry Putnam wrote: > david <[EMAIL PROTECTED]> writes: > > Won't is still quite even with the eval, in the above case? >> passing it to Perl > > Can you give an example of this? no it doesn't. if you put it inside an eval{}, it won't quit. consider

Re: file seek anomolies

2002-09-12 Thread david
with 'read(FILE,$buffer,1024)' and then prints it. as you can see, your '' discard the first line! that's why you won't see the first line from your output. if you were to: while(read(FILE,$buffer,1024) > 0){ print "$buffer\n"; } you should see the first line as well. david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: go to next file

2002-09-12 Thread david
Harry Putnam wrote: > david <[EMAIL PROTECTED]> writes: > >> Harry Putnam wrote: >> >>> david <[EMAIL PROTECTED]> writes: >>> >>> Won't is still quite even with the eval, in the above case? >>>> passing it to Perl &g

Re: open() command and exiting script

2002-09-17 Thread david
the open() statement outside of the loop (like what i did) or you can open your file in append mode like open(FILE,'>>file') 2. use the 'last' statement to exit one level of loop. 3. don't use 'STDOUT' as your file handle unless you have a a good reason. david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: dealing with Prime Numbers

2002-09-17 Thread david
Mark Goland wrote: > Ic...sorry about that, It just didnt work on my XP box, but as I said > great on Solaris. > what is the error message looks like? what version of Perl you have in your XP box? david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mai

Re: Regular expression multiline matching with /m

2002-09-17 Thread david
$/x){ print "match\n"; }else{ print "not match\n"; } __END__ will print match. notice the /x thingy which tell Perl to ignore white spaces. so to match white space again, i have to '\ ' between 'ab' and 'cd'. you don't need to put a bunch of '^' and '$' all over your reg. exp. david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: sorting a hash - multiple key fields

2002-09-17 Thread david
-w use strict; my $h = { a => { name => 'apple', taste => 2 }, b => { name => 'peach', taste => 1 }, c => { name => 'banana', taste => 3}, d => { name => 'peach', taste => 2}}; foreach my $

Re: One last question

2002-09-17 Thread david
relative #-- if that's not the case, $Find::File::dir can help prefix $_ next unless(exists $master{$_}); #-- found a match: #-- #-- $_: is the match filename #-- $Find::File::dir is where $_ is resides in #-- $Find::File::name is the full path

Re: Weird problem with a regexp.

2002-09-17 Thread david
s_time); $e_time = ParseDate($e_time); my $error; my $diff = DateCalc($s_time,$e_time,\$error,1); die "Error comparing: $s_time and $e_time\n" if($error); print "$diff\n"; __END__ david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Simple one :-)

2002-09-17 Thread david
ot;; now if you don't have a function named OUTFILE but a filehandle OUTFILE and you put a comma after OUTFILE, Perl tries to tell you that you are probably don't something wrong. david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Weird problem with a regexp.

2002-09-17 Thread david
Steve wrote: > > > Oops, that if should be which is still giving me the error: > if ($line =~ /^(\d\d-\d\d-\d{4}\s+\d\d:\d\d:\d\d\.\d\d).+Session > i don't see why your expression won't work. prehaps it's something else that isn't working... david

Re: Weird problem with a regexp.

2002-09-17 Thread david
't work. if you have say: 09-23-2002 12:23:21 ParseDate() will take it as: Year: 1909 Month: 223 Day: 2002 Hour: 12 Minute: 23 Second: 21 so: ParseDate('09-23-2002 12:23:21') || die("Invalid date string\n"); will print Invalid date string. david -- To unsubscr

RE: sorting a hash - multiple key fields

2002-09-17 Thread david
Jeff wrote: > Thanks for the response - some questions on your recommendation below: > > -Original Message- > From: david [mailto:[EMAIL PROTECTED]] > Sent: 17 September 2002 19:06 > To: [EMAIL PROTECTED] > Subject: Re: sorting a hash - multiple key fields > &

RE: OT? - Webmaster List

2002-09-17 Thread david
it should be useful to you. :-) david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: nested subroutines and shared variables

2002-09-18 Thread david
use XML::Parser; my $xml = new XML::Parser(Hanlders => {Start => \&start, End => \&end, Char => \&char}); $xml->parse('xml.file'); sub start{ print "Encounter start tag: $_[1]\n"; } sub end{ print &q

Re: creating modules

2002-09-18 Thread david
the basic idea is the same. if you don't know what @EXPORT, use Export, @ISA is all about, you might need more reading. :-) david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Array of Hashes

2002-09-18 Thread david
>2, c=>3); my $scalar = %hash Perl won't convert %hash into array and then assign the number of element to $scalar. what Perl will do is give you the ratio of how efficient your hash is used. if i run the above, it prints '3/8' which tells me my hash is less than 50% full. david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Help ! Newbie here :)

2002-09-18 Thread david
Perl is reading. for example, to extract line 2 and line 3 from a file named foo.txt, i will do: #!/usr/bin/perl -w use strict; my $line2 = undef; my $line3 = undef; open(FILE,'foo.txt') || die $!; while(){ $line2 = $_ if($. eq 2); $line3 = $_ if($. eq 3); #-- o

RE: head as in "unix"

2002-09-18 Thread david
e you don't care anything after 100 lines, why not simply get out of the loop instead of wasting time doing 'next' and compare? aslo, if your file is small, you can also: my @array = ()[0..100]; but that's kind of bad :-) david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: more regexp stuff, maybe?

2002-09-18 Thread david
ement: $" = ','; print "@Fields"; #-- will give you , instead. a better way is: print join(',',@Fields); where "@Fields" calls implicitly with $" david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: simple problem

2002-09-18 Thread david
ou have warning enable (which i think you should), Perl will warn you about that. '==' is for numerical comparison. Again, if you have warning enable, Perl will warn you if it encounter something that doesn't look like a number. you probably want to use 'eq' instead. david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: How to delete data from a file

2002-09-18 Thread david
y get bigger and bigger, this kind of thing is not going to work well. you will want a DBMS such as mySQL,Oracle...etc david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: file execution from a perl file

2002-09-19 Thread david
'internal server error' comes up such as the server do not have permission to execute your script or the server is badly configurated... etc. you also need to read what CGI is all about. you will have a lot to read. :-) david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: head as in "unix"

2002-09-19 Thread david
Anidil Rajendran wrote: > > Hi > He only cares lines 100 onwards > regards oh. i need more coffee and need to pay more attention to the OP. thanks for pointing this out. my bad. david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: how to recognize a number with regex?

2002-09-19 Thread david
uot;; }else{ print "not match\n"; } __END__ it doesn't include things like these: 8. -9. . +. 4.3e david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Using Delta_Format in Date::Manip

2002-09-19 Thread david
d all smaller unit(hours, minutes and seconds). the right format should be: %dd david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Scoping question

2002-09-19 Thread david
e letters as defined in the array. there are a couple reasons why i think this might happen. first, make sure you really move them out of any block. out of any sub{} block might not be enough since you can create any block with a bare {}. make sure they are not inside the BEGIN{},eval{}.. etc of course. if you don't have 'use strict' or warning enabled, enable them and see if there is any warning. second, you are passing the hash as a reference to the subs, make sure the subs do not modify them. is it possible that your subs are actually clearing out those hashes since they are passed by ref? david david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Record Separation

2002-09-19 Thread david
f_record = 0; @records = (); } push(@records,$_); $end_of_record = 1 if(/^/); } close(LINES); __END__ didn't actually test the above but it should work. david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Forking, Passing Parameters to forks

2002-09-19 Thread david
fork, you are just making a copy of yourself(including code,data,stack..etc) so if the file is big, it could consume a lot of memory and if the number of process is large, this will likely to make your machine unstable. make sure you read: perldoc -f fork perldoc -f wait perldoc -f waitpid signals... etc david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: regex and ip address extraction

2002-09-19 Thread david
come after or before the reject=550 part? will the reject=550 part always separeted by the ip part with at lease one byte? try something like: if(/reject=550.+(\[(\d+\.\d+\.\d+\.\d+)\])/){ $address = $1; } assume reject=550 comes first, separate by at least one byte, follow by the ip p

Re: trying to get better with hashes

2002-09-19 Thread david
; -- > This works exactly the way I want it. I can change my print statement > in the foreach loop and print any importatn field that I want. Ther are > no additional fields I need. > > I was wondering what can I do to clean it up. (Maybe be more > efficient) I really don't like having: > > my $msl_Host; > my %msl_Host; i am afraid you can't get away cleanly withtout the my %msl_Host line. david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: how to find memory leaks?

2002-09-20 Thread david
ry pool to be returned back to the OS. but you said you really see a dramatic decrease in memory consumption but if you check your process's memory foot print(let say, simply look at it from the top command), does it's size reduce at all? david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Mail::Send

2002-09-20 Thread david
the module in a wrong way? maybe your mail server is down? a lot of guess but no answer unless you provide something for us to check. david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Parse XML

2002-09-20 Thread david
$kws\n"; $kws = ''; $kw = 0; } } sub string{ $kws .= $_[1] if($kw && $_[1] =~ /\S/); } __END__ the above only extract things inside the tag from the XML file. but you can apply the same technique to the other tags. i didn't really teset the above but hope that should give you something to look into. much easier than writing tons of reg. exp. right? :-) david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Problems with hash of hash referenzes

2002-09-20 Thread david
mething like: $test_timestamp{$tstamp} = { tstamp=>$tstamp,serial=>$serial,retests=>$retests,passfail=>$passfail }; i bet it will work the magic because you are creating one hash reference for each row instead of creating just one hash for all the rows. david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Redirecting output

2002-09-20 Thread david
pid = open(STDOUT,"|-"); die("Unable to attache to STDOUT by fork: $!") unless(defined $pid); print "hello world\n"; } __END__ inside set_it_up() you are redirecting STDOUT back to your script. see if that's what you need. david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: how to find memory leaks?

2002-09-20 Thread david
ally wrong but with my experience with ShareLit, the situation is similiar. indeed, we use similar solution as your forking except that we don't fork, we simply exec(). david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: how to find memory leaks?

2002-09-20 Thread david
), ``... etc in Perl code. i am trying to convince the other developers not to use those as well. i won't got in a debate of the pros and cons of using those. personally, i think they are not portable, unreliable and unsafe. david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Help on Arrays - Beginner

2002-09-20 Thread david
try this: #!/usr/bin/perl -w use strict; print join("\n",sort map { join(', ',reverse split); } ); __DATA__ abcd apply xxx peach yyy dog zzz cat prints: apply, abcd cat, zzz dog, yyy peach, xxx david "Grant Hansen" <[EMAIL PROTECTED]> wrote in me

Re: how to find memory leaks?

2002-09-23 Thread david
Steve Grazzini wrote: > David <[EMAIL PROTECTED]> wrote: >> the heap will not go away (because Perl does it's own memory >> management) until the client exit.). > > Actually, the default config uses libc malloc. you simply can't free() yourself davi

Re: perl - good programming principles

2002-09-23 Thread david
ory) out of Perl by trying to do things like that. This's perfectly ok but i suggest that you don't have to worry about things like that too much. if you decided to code something in Perl, go with whatever Perl can provide. have fun while programming in Perl. :-) david > I know it

Re: Perl & MySQL

2002-09-23 Thread david
nnect to the DB: $DBI::errstr\n"; > __ END __ > > what's wrong? i don't think that's really a Perl question. it looks like your mysql is not accepting the user 'dan' with password ''. better check with your db admin first to run if the db is actaully

Re: compression/seek/tell

2002-09-23 Thread david
PC where seek/tell makes no sense. you can't seek/tell something you don't know. you never know what's happening at the other end. david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

re: FILE COPY

2002-09-23 Thread david
William Black wrote: > Does anyone know how to use the file copy module to past files to remote > servers? > > i.e. > > server 1:x > server 2:y > if your os is unix/linux. try if you have scp like: scp :from_file :to_file Windos might have something similar davi

RE: join hashes?

2002-09-23 Thread david
em, post the portion of code that you suspect is wrong so we can check for you. david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: join hashes?

2002-09-24 Thread david
es to that memory address, do something with it and then it exit. the caller goes back to that memory address, looks up the value in there and can find out what the subroutine has done. there are other usage of reference. the explaination that i gave you is over simplify. a lot of details are omitted. i hope this will give you a good start once you read perldoc again. david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Finding a Pattern in a File

2002-09-24 Thread david
e: ## HTML ## html 1 html 2 html 3 ## TEXT ## text 1 text 2 ## HTML ## HTML 1 HTML 2 ## TEXT ## TEXT 1 TEXT 2 david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Array Handling

2002-09-24 Thread david
o save yourself not having to move the whole array around in function calls? if that's your case, make a reference to the array and use it everywhere: #-- big array my @array = (1..100); #-- reference it my $ref = \@array; #-- now use it everywhere without copying the whole array sub1

Re: Using a variable name to invoke a subroutine

2002-09-24 Thread david
t, use an array: #!/usr/bin/perl -w use strict; my @array = ( [\&sub1,1,2], [\&sub2,3,4] ); for(my $i = 0; $i < @array; $i++){ my @subs = @{$array[$i]}; $subs[0]->(@subs[1..$#subs]); } sub sub1{ print "GETTING: @_\n"; } sub sub2{ print

Re: Removing a directory

2002-09-24 Thread david
fr director/* remove \1, 'directory'; __END__ david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: How do you add a path to @INC

2002-09-24 Thread david
William Black wrote: > Hello all, > > How do you add a path to @INC? > > the simplest way would be just to use the 'use lib' pragmas like: use lib 'path you want to add to @INC'; or: BEGIN{ push(@INC,'path you want to add to @INC');

Re: Sun Sparcstation 20 and Perl?

2002-09-24 Thread david
are side of the machine. but if you just want to play with Linux,Apache,CGI,Perl etc, it should have no problem. david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: GD::Graph::pie -- adding text with GD::Text:Wrap -- How ?

2002-09-25 Thread david
to this image ? > have you try things like: $graph->set( x_label => 'my x label', y_label => 'my y label', title => 'my title', ); is it not working for you? david

RE: File testing

2002-09-25 Thread david
Bob Showalter wrote: > A more idiomatic way to write this is: > >for my $i (0 .. @files) { > you probably mean: for my $i (0 .. $#files){ } the range operator is inclusive. david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: hash

2002-09-25 Thread david
{Start => \&start, End => \&end, Char => \&string}); open(XML,'file.xml') || die $!; $xml->parse(*XML); close(XML); while(my($i,$j) = each %hash){ print "key $i : value $j\n"; } sub start{ $test_number = 1 if($_[1] =

Re: Creating tables?

2002-09-25 Thread david
RY KEY (uid) ) "); > $sth->execute; try: $sth->execute or die $dbh->errstr; to see what's wrong with it david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Help with regular expression

2002-09-25 Thread david
> @list =~ s/\s*//; > > Again will that turn the list into (1992, 1993, 1995)? > you can use substr() to null out from the 5th byte: substr($_,4) = '' for(@list); or you can use the unpack() function which could be a bit faster: print unpack('A4',$_),"\n&

Re: My First Module Advice

2002-09-25 Thread david
s this will certainly make CPAN a garbage can. I think James should test his module as much as possible on as many different platform as possible. it should also be general enough that it doesn't have any application dependent code that he's using during his development for another project. i would say if you feel like it will benefit others, submit it. david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: My First Module Advice

2002-09-25 Thread david
James Edward Gray II wrote: > On Wednesday, September 25, 2002, at 05:37 PM, david wrote: > >> bug, more efficient, more portable, etc. who knows maybe James' module >> is >> more efficient than the already exist CPAN module, maybe it's more >> portable

Re: Looping through readdir()

2002-09-25 Thread david
eaddir(DIR)){ print "$dir\n"; } ... etc instead of print, you can capture them in an array and then exam them in that order you want. david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: My First Module Advice

2002-09-25 Thread david
Bob Showalter wrote: > http://www.cpan.org/modules/by-module/Silly/ oh my god! i don't really mean to insult whoever wrote the module. i am just using it as an example. :) david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: use perl to trim out non text characters from a file

2002-09-26 Thread david
would just > extract these characters? > the characters you see are probably extended ASCII characters, try remove them like: my $i = "string with extended ASCII character"; $i =~ s/(.)/ord $1 > 177 ? '' : $1/ge; david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: fork exitting sub

2002-09-26 Thread david
nd why you need another 'while fork' here. thte parent goes into the while loop, do stuff and then exit. the child process simply ignore the while loop and then immediately exit. the child does nothing. the 'while fork' seems unecessary. david -- To unsubscribe, e-mail: [E

Re: Hide a string while saving it to file

2002-09-26 Thread david
} sub mess_it{ my $s = shift; $s =~ s/(.)/chr(ord($1)*2)/ge; return $s; } __END__ anyone who knows a little Perl can easily figure out a way to decode the mess-ed string. it's not secure at all. but if you just want to prevent users from looking at your data, that might

Re: Hi

2002-09-26 Thread david
Mark Schouten wrote: > > %flavors = ( change the above to: my %flavors = ( and try again. read the Perl book's scope section again :-) david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Read a file directly from system call?

2002-09-26 Thread david
quot;); which would only work if it's a pm > I also tried variations on: > open (MYFILES, (system("unzip $myfile1 doc.txt"))); > > Any clues? Thanx! have you try: open(ZIP,'unzip -c $myfile1 |') || die $!; while(){ #-- do whatever you want to do... } close(ZIP); david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: fork exitting sub

2002-09-26 Thread david
Chad Kellerman wrote: > david, > > actually, without the while loop every user in the array gets forked > at one time. 500+ forks. I put the while loop in and it does one at a > time.. > maybe i am missing something but how is this: > foreach my $usr (@users)

Re: How to execute a Perl script from a web page?

2002-09-26 Thread david
nk 2. calls a CGI script 3. the CGI script does something but the result is not send back to the browser, instead it's stored somewhere in the file system. 4. the CGI script finish and a knowledge is send to the browser it would be great if you can provide what your OO Perl program does a

Re: Help with including a counter

2002-09-26 Thread david
lace them with: $whats_new_index_text .=<<"TEXT"; $td_label_value_root$font_label_string_root $line_array[1] TEXT which reads better. if you don't care anything beyond the first 20 lines, you should consider adding a 'else{last;}' to your script so that you can

Re: Preferred way to move and compress a file

2002-09-26 Thread david
self. moving files(even several hundred megs) locally(ie, not to another mount point or another FS and stuff like that) is very fast because no data is actually copy around, the OS simply make a change to the file's inode dictionary. david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: How to get file version?

2002-09-26 Thread david
Ha Le wrote: > I read in a but I don't know how get the file version out of > the file. It seems Perl stat() doesn't work this way. Anybody knows what > Perl function or module will work? > what file version do you refer to? david -- To unsubscribe, e-mail:

RE: "Or" Syntax

2002-09-26 Thread david
partition. can you let us know how do you get @array? we need to know what's in $array[2]? looking at your 'if' statement, it seems to be ok. the problem could be how you get @array and what's really in $array[2] david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For

Re: system call troubles...

2002-09-27 Thread david
f you don't want exec() to replace your script, you can manually exec() after a fork: fork || exec($playerApp, $webCast); you also don't need to put () around $webCast david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: "Or" Syntax

2002-09-27 Thread david
now if $a is 'Public', all three of the if statement is true and the last if statement sets $b equal to 3 which overwrites whatever is set in the first 2 if statement. i am not sure if that's really what you want or do you mean: if($a eq 'Public'){ }elsif($a eq 'Whatever'){ }elsif($a eq 'Something'){ }else{ } david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: dbmopen can't open /etc/aliases.db file

2002-09-27 Thread david
mopen(..) } and check the $@ error if you can, try not to use dbmopen at all, tie is better, safer and faster. david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: output to console and to logfile.

2002-09-27 Thread david
you print won't appear to your terminal screen. use print STDERR along your print statment to print both to screen and log file. Or just don't use STDOUT, open a different file handle for the log file. david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: newbie - in

2002-09-27 Thread david
sts $h{34}){ print "found 34\n"; }else{ print "34 not found\n"; } don't use hash if: 1. @i has duplicate value which you want to keep 2. order is important 3. @i is huge and takes up a lot of memory david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: system call troubles...

2002-09-27 Thread david
Jenda Krynicky wrote: > From: david <[EMAIL PROTECTED]> >> Chris wrote: >> >> > # ** ** >> > # print "Trying to Run -- system $playerApp ($webCast):\n"; >> > # system $playerApp, ($webCast); >> > # ** ** >> &g

Re: dbmopen can't open /etc/aliases.db file

2002-09-27 Thread david
Bruno Negrao - Perl List wrote: > Ok david. > > Could you send me a code example of a database file being opened for > reading with tie? > > thanks, > bnegrao. use NDBM_File; tie(%HIST, 'NDBM_File', '/usr/lib/news/history', 1, 0); while (($key

Re: dbmopen can't open /etc/aliases.db file

2002-09-27 Thread david
if tie works, chances are that dbmopen should work as well. but since Perl does not recommand using dbmopen, we should respect that. david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Problem installing A module

2002-09-27 Thread david
ot try perl -MCPAN -e 'install Quantum::superpositions'? you have a Quantum computer? :-) david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: output to console and to logfile.

2002-09-27 Thread david
e hanldes like: tie *STDOUT 'Tie::FileHandle::MultiPlex', *FH1, *FH2, *F3; #--... etc readme: http://theoryx5.uwinnipeg.ca/CPAN/data/Tie-FileHandle-MultiPlex/README.html david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Searching & Storing

2002-09-27 Thread david
); } foreach my $i (@db){ if($i->[0] >= $dates[0] && $i->[0] <= $dates[1]){ print "Found: ",join(' ',@{$i}),"\n"; } } } __END__ try it and see what happen. i am sure you can make it better. david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: problem with overlapping matches and while m//g

2002-09-27 Thread david
or the next match. i suggest that you don't have to look at Perl's reg. expression engine this way. the backtracking nature of Perl's reg. algr. has other purpose such as when the '*' or '+' quantifier is encountered. if you simply want to know how many times a s

Re: need little help with reg expressions

2002-09-27 Thread david
David Mamanakis wrote: > > sub validateCLSMSResponse > { > my $self = shift; > my $Response = undef; > my $CheckString = shift; > my @Holder = shift; the above could be bad. you only shift one element from @Junk into @Holder. If you have: @Junk = ('hi',&#x

Re: Regarding decrementing IV_MIN(Integer minimum)

2002-09-28 Thread david
al. this should explain why after you subtract one from it, it's still prints ok. the overflow thingy that i mention doesn't seem to affect the following though: $i = '9'x99; #-- that's 99 digits! definitly overflow print $i+1,"\n"; #-- prints 1e+099 which

Re: Searching & Storing

2002-09-30 Thread david
1. download Date::Manip from CPAN manually 2. untar it like tar -zxf 3. cd directory 4. perl Makefile.PL 5. make 6. make test 7. make install 8. make clean run the above as 'root' and it should install without error. david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Searching & Storing

2002-09-30 Thread david
;; my $date2 = '2002-2-23 02:34:12'; suddenly, $date2 is 'bigger' than $date1 but $date1 is Dec 2002 and $date1 is only Feb 2002. 2. another way is to convert the date string into seconds with Time::Local and localtime. when the user enter a date, convert it to seconds and then compare it with whatever you parsed from the log. i would recommand you using this method david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: system call troubles...

2002-09-30 Thread david
ven OS that do not support fork() can be fork. i am not sure if that is true on Windos or not. prior to 5.6, yes fork() is implemented differently(or not implemented at all for some OS) but after 5.6, Perl handles this by dupping itself, which is very expensive according to the doc but it gives

Re: Permission Problems

2002-09-30 Thread david
have the permission denied error. hum... could it be that another process is locking up the file? david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: How to snip the end of a huge log file

2002-09-30 Thread david
the following is for the first 2 lines from the top seek(FH,tell(FH)-2,0); next unless(tell(FH) == 1); read(FH,$b,1); unshift @character,$b; seek(FH,0,0); read(FH,$b,1); unshift @character,$b; print join('',@charact

Re: Breaking out of STDIN Question

2002-09-30 Thread david
ts with a number but doesn't contain purely number. so if you want to avoid those warning, you can disable warning (which is not recommanded) or you have to enter a pure number. :-) david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: SQL Table Rows

2002-09-30 Thread david
e idea right? } to find out how many rows are in the table, try: SELECT COUNT(*) FROM table; david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Finding if a module is already 'require'd

2002-09-30 Thread david
ay: sub already_required{ my $module = shift; eval{ require $module; }; if($@){ #-- something is wrong. $module could be missing return 0; }else{ #-- looks like $module is successfully loaded

Re: how to know weather perl script is already running?

2002-09-30 Thread david
trict; use Proc::ProcessTable; my $t = new Proc::ProcessTable; foreach my $p (@{$t->table}){ if($p->cmndline =~ /running\.pl/){ print $p->cmndline," already running!\n"; last; } } __END__ david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: $1, $2, $3, ... as array

2002-09-30 Thread david
ment string(or expression with as many / as you want). the word 'capture' doesn't make much sense here. for example: my $i = 'abcd 1234'; my $j = 'hi; $i =~ s/abcd/($hi)/; the '()' in replacement is not capturing anything, it's taken as it's. $i

Re: Can I append @INC before use

2002-09-30 Thread david
t; Can I get to use 'use' instead of require any how > > Thanx > Ram what sort of error message do you get? assume i have: /home/david/perl/A.pm, the following works for me: BEGIN{ push @INC, '/home/david/perl'; use A; } david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: pop-up window with database access

2002-09-30 Thread david
this kind of client side pop-up window stuff. :-) i don't know how much help we can provide here unless you tell us at least what have you try. what your plan is. any problems(be specific) you encounter. david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: check process state

2002-09-30 Thread david
Proc::ProcessTable in CPAN. it does everything you ask for and much more such as 'give me all process that's using more than 50% of the system memory' or 'give me a list of process that have sleep for more than 5 minutes'... etc. david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: STDIN

2002-09-30 Thread david
> Chat with friends online, try MSN Messenger: http://messenger.msn.com is your application a CGI application? if so, whatever the text the user enter into the text box is passed in as param. maybe you can check out the CGI module? david -- To unsubscribe, e-mail: [EMAIL PRO

<    1   2   3   4   5   6   7   8   9   10   >