Re: renaming all files in a directory

2002-06-07 Thread Janek Schleicher
Jeff Hooge wrote at Fri, 07 Jun 2002 17:49:37 +0200: > All right, first off I'm a total perl newbie (about 2 days now) and am looking for >some resources > on how to do a few things. Resources, meaning, don't tell me how to write the script >just point me > in the right direction of where to st

RE: changing behavior by user command

2002-06-07 Thread Janek Schleicher
Nikola Janceski wrote at Fri, 07 Jun 2002 15:02:22 +0200: > perhaps use qr// to "precompile" the search instead and use that new precompiled var >within your > loop so you don't evaluate the if conditions each looptime. > > my $search; >if ( $WholeMatchOnly ) >{ > if ( $IgnoreCase

Re: lvalues

2002-06-06 Thread Janek Schleicher
Mark Anderson wrote at Thu, 06 Jun 2002 18:48:32 +0200: > I came across a reference to lvalue(s) in >perldoc -f substr > I then searched perldoc for "lvalue", and looked at each reference in: >perldoc perldiag >perldoc perltoc >perldoc perlfunc >perldoc perlsub >perldoc pe

Re: parse file into hash

2002-06-06 Thread Janek Schleicher
Alaric Joseph Hammell wrote at Wed, 05 Jun 2002 20:47:55 +0200: > Hello, > I am new with perl and was hoping to get some direction. > > I am attempting to parse a the attached .txt file. > > i need to be able to access the information by unique keys, QUAD_NAME and >USGS_QD_ID. Also, I wan

RE: Multi-Dimensional Array and push()

2002-06-05 Thread Janek Schleicher
Janek Schleicher wrote at Wed, 05 Jun 2002 20:14:27 +0200: >> I am trying to print the newest value in the array. >> >> $questionpos[$questionno][$#{$questionpos[$questionno]}] >> >> > print $pos[-1]; > Sorry, I wrote to quick: print $pos[$no][-1]; C

RE: Multi-Dimensional Array and push()

2002-06-05 Thread Janek Schleicher
Jess Balint wrote at Wed, 05 Jun 2002 20:00:57 +0200: > Thank you. That is all find and dandy now. But what about the print line: > > I am trying to print the newest value in the array. > > $questionpos[$questionno][$#{$questionpos[$questionno]}] > print $pos[-1]; Greetings, Janek -- To un

Re: probably a simple question

2002-06-05 Thread Janek Schleicher
Bryan R Harris wrote at Wed, 05 Jun 2002 19:51:49 +0200: >> $_ % 2 ? print "blue\n" : print "red\n" foreach (@your_list); > > > This actually works?! Very strange notation, how does the compiler see this line? >I assume the > mod operator evaluates to 1-true or 0-false, what does the "?" do?

Re: Multi-Dimensional Array and push()

2002-06-05 Thread Janek Schleicher
Jess Balint wrote at Wed, 05 Jun 2002 19:19:15 +0200: > Hello all. I have trying to push a value onto the end of a two-dimension array. Here >is my code. > > if( /\s+--\s+COLS\.\s+(\d+)\s+-\s+(\d+)\s+--/ ) { > push( @{questionpos[$question

RE: Regex Problem - please help

2002-06-05 Thread Janek Schleicher
Janek Schleicher wrote at Wed, 05 Jun 2002 16:19:11 +0200: > Yep, if you like it short ;-) > open BOOK_LIST, " print join "\n", map {chomp; /(.*) by (.*)/; "$2 - $1"} (); ^^^ Oh a typo :-( >

RE: Regex Problem - please help

2002-06-05 Thread Janek Schleicher
Robert Hanson wrote at Wed, 05 Jun 2002 15:57:05 +0200: > Here is my solution, others will differ... > Yep, if you like it short ;-) open BOOK_LIST, "); close BOOK_LIST; > # always print $! on error so you can see the cause open( INFILE,"books.txt" ) || >die "Cann't > Open: $!"; > > while(

Re: sequences of capitalized words

2002-06-05 Thread Janek Schleicher
Patrick Hall wrote at Wed, 05 Jun 2002 11:01:31 +0200: > Hi, > > I'd like to push all sequences of capitalized words onto an array. > > So, given this paragraph (which I just snagged off AP) > Indian Prime Minister Atal Bihari Vajpayee said > Wednesday that India would consider jointly monitori

RE: Read a file into a Hash

2002-06-04 Thread Janek Schleicher
Ned Cunningham wrote at Tue, 04 Jun 2002 20:16:46 +0200: > It's a pipe delimited txt file. > Examples always help us. I assume your file looks like key1|value1 key2|value2 ... keyn|valuen Then you should try: open FILE, "<$filename" or die "Can't open $filename: $!"; my %hash = map {chomp; sp

Re: ideas and help with FS usage

2002-06-04 Thread Janek Schleicher
James Kipp wrote at Tue, 04 Jun 2002 16:24:04 +0200: > ... > here is some code: > -- > use File::Find; > find (\&wanted_user, "$dir"); > > sub wanted_user > { > %sum = (); > next unless (-d $_); > ($user,$size) = (stat($_))[4,7] or die "can't stat: $!\n"; push (

Re: Slow script

2002-06-04 Thread Janek Schleicher
Trevor Nichols wrote at Tue, 04 Jun 2002 15:52:38 +0200: > I've got two machines here which are pretty crappy but there seems to be something >seriously wrong > somewhere. One machine, a Pentium 200 MMX with 80MB ram runs a very simple script >taking 5 > seconds. > > t@data:~$ cat test.pl > u

Re: Regex problem extracting middle-word part of string

2002-06-04 Thread Janek Schleicher
Rohesia Hamilton Metcalfe wrote at Thu, 30 May 2002 17:28:45 +0200: > #make array of cgi-scripts: > @Scripts=("f-.cgi", "f-bb.cgi", "f-.cgi", "f-.cgi", "f-ee.cgi", > "f-ff.cgi"); > > # pick one at random > srand; > $RandomScript = $Scripts[int(rand(@Scripts))]; > I agre

Re: remove the stop words

2002-06-04 Thread Janek Schleicher
Ying Liu wrote at Mon, 03 Jun 2002 17:11:22 +0200: > Is there a good method to do this? I need to remove the stop words from the comment >field of every > record. There are about 20,000 records. The comments look like this: > > Yersinia pestis strain Nepal (aka CDC 516 or 369 isolated from huma

Re: dbi connection problem with @INC

2002-06-01 Thread Janek Schleicher
Tom Poe wrote at Sun, 02 Jun 2002 00:26:24 +0200: > Hello: The script worked at one point, with use DBI; then, I upgraded perl from >5.6.0 to 5.6.1 > and got into trouble. I have both running now. What I want to do, is to figure out >how to get > use DBI to go find DBD/Pg.pm. Any pointers

Re: count issue

2002-06-01 Thread Janek Schleicher
Lance Prais wrote at Sat, 01 Jun 2002 01:17:55 +0200: > I would like to read the following to see if on line is repeating more then once. > > I would start this? > > I was trying something similar : > > my $line=$_; > my @results = $line =~ m/(sleeping for 10)/gi; > print 'Found ', scalar (@re

Re: Error with perl compilation of GD

2002-05-31 Thread Janek Schleicher
Luis Valencia wrote at Thu, 30 May 2002 17:44:23 +0200: > HI, i try all of this and now i got a new error message > > proxyserver /downloads/GD-1.33 > sudo make perl > gcc -c -I/usr/local/include -I/usr/local/include/gd -fno-strict-aliasing -I/ >usr/local/include > -D_LARGEFILE_SOURCE -D_FILE_O

Re: Perl Compiler

2002-05-30 Thread Janek Schleicher
Harry Jackson wrote at Thu, 30 May 2002 18:13:57 +0200: > Not sure if anyone is interested but have a look for perlcc on google. It compiles >perl into c > > Harry > > > > >* >COLT > Telecommunications > R

Re: opening text file

2002-05-30 Thread Janek Schleicher
Greg D . wrote at Thu, 30 May 2002 23:52:35 +0200: Like Beau E. Cox, I don't know, too, why it doesn't run. But when it will run, you should take off the preparation of the sql command out of the while loop. That's why the command is created for. So you can speed up and more important improve th

Re: Text manipulation

2002-05-30 Thread Janek Schleicher
Jakob Kofoed wrote at Thu, 30 May 2002 22:13:42 +0200: Sorry, I don't know enough of the format command to help. But that seems to be a little bit long. > print "Enter Path DATA file .. \n"; > chop($file = ); > > print " \n"; > print "Enter DATA1 ... "; > chop($data1 = ); > > p

Re: union of times algorithm

2002-05-30 Thread Janek Schleicher
Felix Geerinckx wrote at Thu, 30 May 2002 14:41:45 +0200: > on Thu, 30 May 2002 13:06:04 GMT, [EMAIL PROTECTED] (Janek Schleicher) wrote: > >> Sorry, but 3 to 10 are 3,4,5,6,7,8,9,10 = 8 times >> and 15 to 20 are 15,16,17,18,19,20 = 6 times. >> So the answer shoul

RE: Problem reading a file and passing a variable

2002-05-30 Thread Janek Schleicher
Lance Prais wrote at Thu, 30 May 2002 01:47:34 +0200: Perhaps you missed to chomp th $ln. So $ln = "1-294613112\n" what is perhaps not what you wanted. > This is the most bizarre thing I have ever seen. I am using the following code: >There is > absolutely no reason why this should not return

Re: union of times algorithm

2002-05-30 Thread Janek Schleicher
Bryan R Harris wrote at Thu, 30 May 2002 01:58:19 +0200: > I'm trying to come up with an algorithm that seems like it ought to be really easy, >but it's > turning out to be pretty tough... > > Basically I have three pairs of start/stop times, e.g.: > >3, 5 >4, 10 > 15, 20 > > I wan

Re: converting a hash to an array

2002-05-29 Thread Janek Schleicher
Felix Geerinckx wrote at Wed, 29 May 2002 17:17:38 +0200: > on Wed, 29 May 2002 16:10:40 GMT, [EMAIL PROTECTED] (Janek Schleicher) wrote: > >> Oops, there's a typo :-(( >> >> Of course, I meant >> @sorted = reverse sort { $myhash{$a} <=> $myhash{b}

Re: what does a diff return?

2002-05-29 Thread Janek Schleicher
Jose Torres wrote at Wed, 29 May 2002 20:30:06 +0200: > Hi, > > If I'm calling the diff program from within a Perl script with something like: > > system("diff file1.txt file2.txt"); > > how can I detect if there is a result or not, since if the files are identical, diff >doesn't have > any o

Re: Help handling text files.

2002-05-29 Thread Janek Schleicher
Josh wrote at Wed, 29 May 2002 23:56:48 +0200: > Ok Heres the deal :) I have a script to write to a dat file and the basic output in >the dat file > is > > username:plan: so an example would be > computer:50: meaning the username computer has 50 hours of paid dialup access. > > Now Lets say "c

Re: converting a hash to an array

2002-05-29 Thread Janek Schleicher
Janek Schleicher wrote at Wed, 29 May 2002 17:20:02 +0200: > Make it more readable and write: > > @sorted = reverse sort { $myhash{$b} <=> $myhash{b} } keys %myhash; Oops, there's a typo :-(( Of course, I meant @sorted = rever

RE: iterating over the contents of a directory

2002-05-29 Thread Janek Schleicher
Jose Torres wrote at Wed, 29 May 2002 16:41:23 +0200: > Thanks for your help everyone. I had a related question. It looks like readdir just >return > relative filenames and not absolute ones. Is there a way/method to return absolute >filenames? For > example, if I'm in /home/docs that has a tex

Re: converting a hash to an array

2002-05-29 Thread Janek Schleicher
Craig Hammer wrote at Wed, 29 May 2002 14:58:33 +0200: > I've found a couple of examples of moving an array into a hash, but not of moving a >hash into an > array. > > I thought this would work: > > @sorted = sort { $myhash{$b} <=> $myhash{a} } keys %myhash ; > I'd like to give another hint,

Re: Is there a good Perl way for a validation subroutine?

2002-05-29 Thread Janek Schleicher
Tagore Smith wrote at Wed, 29 May 2002 06:13:25 +0200: > ... > > in pseudocode: > > my @failed; > if (field fails validation){ >push @failed, $fieldname; > } > } > etc. > Or in another pseudocode: my @failed = grep {field fails validation} @fields; Cheerio, Janek -- To unsubscribe, e

Re: Formatting Output

2002-05-29 Thread Janek Schleicher
Melissa Cama wrote at Wed, 29 May 2002 03:13:46 +0200: > ... > I need to print out each value in the array (for each key) as a new line in an >excel/CSV file. > Also with each new line, a time stamp needs to be printed. > ... > foreach $str_feature (%hash_FeatureUsers){

Re: Referring to a cgi script within a cgi script.

2002-05-29 Thread Janek Schleicher
Richard J. Moyer III wrote at Wed, 29 May 2002 02:39:45 +0200: > Hello all, > > I have a form that activates a cgi script that scans a flat-file *.csv file, matches >on a unique > identifier, identifies the line that contains the identifier, and pushes the >separated values of > that line into

Re: sending mail from Perl redirecting from a file

2002-05-29 Thread Janek Schleicher
Lz wrote at Tue, 28 May 2002 17:57:57 +0200: > Hi guys, > > open TMP, ">/home/dev/perl/mail_queue/$filename" or die "Can't create file: $!"; > > I read an incoming file, modify it and save it in the file, as seen above. > > Later on, I'd like to send the above generated file: > > I try the fo

Re: elements 2 thru end of the results of a split

2002-05-29 Thread Janek Schleicher
Bryan R Harris wrote at Wed, 29 May 2002 01:36:23 +0200: > Is it possible to return elements 2 (index 1) > thru end of the results of a split? > > @myarray = (split(/\s+/,$fContent[$i]))[1..-1]; > > seems right, but doesn't work... > The problem of your code is that 1 .. -1 is an empty li

Re: Requesting some help. Any Ideas about this code and err msg?

2002-05-25 Thread Janek Schleicher
Daniel J. Rychlik wrote at Sat, 25 May 2002 04:00:27 +0200: > Hey Guys I need some help. I have been working on this script for a week now trying >to out put my > sql data into an excel macro. I have tried everything I know how to do and I need >some direction. > Please advise. > > Heres m

Re: Need help in Regular Expression

2002-05-24 Thread Janek Schleicher
Ankit Gupta wrote at Fri, 24 May 2002 17:13:52 +0200: > Hello, > > I am working on a project in which I need to get Date part of > below written header. I am trying to use Regular expression to extract Date: line. I >am able to > achieve everything after the Date: word but not only th

How to install Math::LP::Solve

2002-05-24 Thread Janek Schleicher
0s (0s total since program start) CPU Time for solving: 0s (0s total since program start) lp_examples/ex7.lp gives the correct result Like you can see Test 5 was not alright, but I don't know what it does mean Thanks for any help, Janek Schleicher -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

<    1   2   3   4