RegExp

2001-06-29 Thread Timothy
I'm sure this is a really easy question but here goes. I'd like to replace each leading blank of a string with   I have currently: $strLine =~ s/^\s+/ /g; I can see that this will simply take all leading blanks and replace them with one   but how do I get *each* leading blank to

Constant Question

2002-08-28 Thread Timothy
ot;19")},height=>'1',-text=>'Browse')->pack(-side=>'top',-anchor=>'w'); last SWITCH; } } push @arrButton, $objButton; As you can see the only thing that is changing is the constant "1" to "19" in the subroutine pa

Re: Constant Question

2002-08-29 Thread Timothy
tons=>['Ok'] ); The above dialog box pops up in some light yellow color and then slowly repaints intself grey. How do I avoid the initial light yellow color? I'd prefer a solution from within Perl rather then editting an X file. TIA:) -- -Timothy eMail: [EMAIL PROTECTED] W

Perl/Tk

2002-09-04 Thread Timothy
change the default color for all windows/widgets from within Perl/Tk? $objDialogBox=$objWindow->Dialog( -background=>'grey', -title=>"NOTICE", -text=>"This space intentionally left blank.", -default_button=>'Ok',

Re: #!/usr/bin/perl

2001-06-07 Thread Timothy Kimball
Eric Wright wrote: : I installed Perl, when I search for perl I get /usr/bin/perl, but when I : include #!/usr/bin/perl in my source I still cant exicute it without; was that "which perl" or "whereis perl"? -- tdk

Re: SWAPING COLUMNS

2001-06-08 Thread Timothy Kimball
Pedro A Reche Gallardo wrote: : Hi all, I have a file with 20 columns of positive and negative decimal : numbers (eg: 9.782 -8.983) separated by a black space, and everycolumn : is marked on top with an single alphabet letter. : This is an example. : : A D C B : 9.782 -8.983 -3.

Re: require command?

2001-06-12 Thread Timothy Kimball
Max Attems wrote:: second attempt, now with correct email. : I saw an article about the list in perl.com : today an persisting error message occured. perhaps you would now a simple : answer. : : this is the code: : #!/usr/bin/perl -Tw : ... : require 'conf.cgi'; : : the conf.cgi is not mispell

Re: Pushing more than 1 item onto a list

2001-06-12 Thread Timothy Kimball
Charles Lu wrote: : Functions like pop(), push() allow you to add or remove one element to or : from a list. Is there a function that allows you to add or remove "X" : number of elements where "X" > 1? push() can push more than one element: push(@array, $x, $y); But splice() can handle the

Re: require command?

2001-06-12 Thread Timothy Kimball
Max Attems wrote: : now conf.cgi is ok but still, i get this error message, which i couldn't : fix: : Use of uninitialized value in string ne at send.cgi line 20. : line 20 is looking for a string defined in conf.cgi, why does it not use it. : line 20: if( $pass ne $passwort ) { : (the variable w

Perl Module

2001-08-07 Thread Timothy Power
Greetings, I'd like to start off by letting you know there is no such thing as too much advice on this end, so feel free to write me a book if you have the time. Attatched is a module I wrote (NameSplitter1) that takes a full name field and splits it into prefix,firstname, middlename,lastname,s

RE: Getting a list of USERS from an NT USER GROUP

2001-09-05 Thread Timothy Johnson
Here are two scripts that I use. GetUsers_Shortlist.pl just retrieves a list of usernames. GetUsers_All gives an example of some of the other information you can get using NetAdmin. The third one is the same as the first, except it gets only computer accounts. -Original Message- From:

Re: Removing Leading Zeros

2001-04-19 Thread Timothy Kimball
: I have sucked two substrings into two variables : : : $index = substr $_, 35, 11; : $value = substr $_, 64, 6; : : These variables may or may not have leading zero/s : : : 09/99/000999and so on. : : If they do I need to strip away the leading zeros. A regexp replacemen

Re: matching with a loop

2001-04-19 Thread Timothy Kimball
: open(BW,$bw) || die &dead("Can't find Bad word list", $!); : @indata = ; : close(BW); : : $tmp = join ("|", @indata); I think you need to chomp the lines you read from $bw. Otherwise they'll still have newlines in them. (hint: print out $tmp to see what the regex will look like.) Try this

Re: Am I asking too much????

2001-04-24 Thread Timothy Kimball
: if ((($amounts{$cheque}) - $amount) != 0) { : : $sth1->execute(split/,/) : } : : ... : : However the $sth1->execute(split/,/) is giving me all the fields from the : original file (when I only want 2) and I get

Re: Parsing the output

2001-04-24 Thread Timothy Kimball
: I 've an output from the system comand as follows. : : * /xxx/ /yyy/ : * /www/ /vvv/ : * /uuu/ /ttt/ : ::: : : I want to parse this output into an array and split them and process each : entry. Essentially, I want to parse the output of a com

Re: [BPQ] help!! any idea whats wrong with this??

2001-04-24 Thread Timothy Kimball
: so...this is suposed to count the words in FILE and return how many occourances of :each word there were...its not working for me thoughits only returning the count :for the last word in the file...help Think: In the first loop, what happens to the first line when you move to the second?

Re: Complex Regex.

2001-04-24 Thread Timothy Kimball
: I thought I was improving at expressions but this one has me stumped: : : I have text interspersed with numbers. The text can be anything, including : all types of punctuation marks. Well (sound of knuckles cracking), let's see... I've only been on the list a couple of days, and I've alread

Re: Complex Regex.

2001-04-24 Thread Timothy Kimball
Slight correction to my last post: : my $float_re = qr{ : : \d+\.\d+ # Matches "2.3" : | \d+\. # Matches "2." : |\.=d+ # Matches ".2" : | \d+ # Matches "2" : : }x; # "x" means "extended regex syntax" In the third line of the first regex, "=" should be

Re: More Help: Complex Regex

2001-04-24 Thread Timothy Kimball
: Some of the files have HTML headers and footers. I don't want any data : inside HTML brackets. I tried: : : s/<*>//g; : : I don't understand why this doesn't work. Because (a) "<*" in a regex means "zero or more less-thans", and (b) Perl regex matching is greedy- it matches the longest

Re: [beginner] file parsing question

2001-04-24 Thread Timothy Kimball
Ah, yes, one of the most frustrating bugs in the world: : if ($REFln[1] = "SN") { This *assigns* the value "SN" to $REFln[1]. What you want to do is *test* it. String comparisons in Perl are done with "eq" (and numeric comparisons with "=="). So you want this: if ($REFln eq "SN")

Re: More Help: Complex Regex

2001-04-24 Thread Timothy Kimball
: Try s/<.*>//g - the . means "any character" and will eliminate a : less-than, then 0 or more characters, then a greater than. Careful: if there's more than one greater-than in the line, this regex will wipe out everything between (and including) the first "<" and the last ">" on the line, beca

Re: tough sort question

2001-04-25 Thread Timothy Kimball
: I need to sort all records by: 1) dept, name, record type. : ... : The real problem I have is with the "name" field being in one record only. : The 'xx' values show that the name cannot be simply copied to the remaining : records. Try a two-pass solution: first create a hash that maps IDs to n

Re: inserting text into file

2001-04-25 Thread Timothy Kimball
: Could this be a buffering problem? : Maybe $|=1 at the top of the script would help? : Does it need a seek()? Hmm seek() does appear to work: open GBOOK, "+

RE: inserting text into file

2001-04-25 Thread Timothy Kimball
: I tested the code below and note that this is not INSERTING text into the : file, but overwriting existing characters that are already in the file. oops, you're right. Wasn't looking close enough. It's been a long day. I think you're also right that there isn't a way to insert chars into a fil

Re: replacing an element in an array

2001-04-27 Thread Timothy Kimball
: Am rather a beginner at perl and was wondering how to do the following. I've : read in a text file containing a list of file paths. the list is read in to : an array. I want to scan through the whole array and remove all lines with : end as .txt and .scc. i.e remove that element in the array.

Re: replacing an element in an array

2001-04-27 Thread Timothy Kimball
: You are making the RE engine do a log of work there. You're right, your way is better. I tend to write code that is clear to the way I think and then optimize it later (usually with a profiler). Should get more in the habit of "use re 'debug'". -- tdk

Re: Error

2001-04-27 Thread Timothy Kimball
: Global symbol "$fh" requires explicit package name at : livonia.pl line 22. : Execution of livonia.pl aborted due to compilation errors. You have "use strict" turned on, so put "my" in front of $fh in line 22. to give it scope. "strict" would rather you didn't use globals. : Also can some one

Re: [BPQ] help!! any idea whats wrong with this??

2001-04-27 Thread Timothy Kimball
: Because someone (and with apologies to all, I don't recall off the top : of my head who)correctly pointed out to me earlier in this thread that : using map() here was inefficient. map() builds and returns an array, so : there's no point in using it in this void context. Aside from that, : both

Re: [BPQ] help!! any idea whats wrong with this??

2001-04-27 Thread Timothy Kimball
: Ah, a Heisenbug. There's a problem with your benchmarking: Yep, you're right. map is slightly slower when it actually has something to do. I stand corrected... again. So the moral of the story is: If you want your code to run really fast, make it do nothing. ;) That's what I love about Per

Re: Include directory as location of perl script

2001-04-27 Thread Timothy Kimball
: but I am having trouble stripping $0 of the perl script name. The standard File::Basename module has a dirname() function that will do that for you. Alternatively, you can say something like this in your perl script: use lib '/path/to/your/module/file.pm'; -- tdk

RE: subroutines in .pm

2001-04-27 Thread Timothy Kimball
: I am using a WinNT system and I'm running a script that calls : a subroutine in file1.pm. Then file1.pm calls a subroutine : from file2.pm. The script can't seem to find the subroutine : that in is in file2.pm. Does your file1.pm have "use file2" in it? -- tdk

Re: Got a project for Perl but need some help

2001-04-30 Thread Timothy Kimball
: Just curious, how would you send an attachment? The MIME::Lite module can do this. -- tdk

Re: IF statements

2001-05-01 Thread Timothy Kimball
: I think what I need is something called a case. but I can't find the syntax : anywhere. Perl doesn't have an official case (that is, switch) statement, but there is a Switch.pm module available on CPAN. Here's the synopsis from its manpage: use Switch; switch ($val) {

Re: Outputting content to the web

2001-05-01 Thread Timothy Kimball
: #!usr/bin/perl Shouldn't this be #!/usr/bin/perl -- tdk

Re: eliminating duplicate lines in a file

2001-05-02 Thread Timothy Kimball
brahmanyam <[EMAIL PROTECTED]> wrote: : > Hi, : > Iam reading flat text file of 10 lines. Each line has got data of : > maximum 10 characters. : > I want to eliminate duplicate lines and blank lines out of that file. : > i.e. something like sort -u in unix. : : Got plenty of memory? =o) : :

Oracle/CGI/Perl (was: RE: I am a real begginer to perl......)

2001-05-02 Thread Timothy Kimball
: I am also a beginner and wondering if there are any other recommended : books other than the camel book from O'Reilly. I have been asked to : display information from the Oracle Database on the web using Perl and : CGI. So far, I mostly know how to check for patterns. Gulp!! O'Reilly has al

Re: String deconstruction?

2001-05-02 Thread Timothy Kimball
: Hello. I am attempting to print a string one character at a time. Right now I am :using one while loop with chop to create a new string, the reverse of the original :string, then another while loop with chop on the reversed string to print out the :characters. I'm sure there's a more stra

Re: String deconstruction?

2001-05-02 Thread Timothy Kimball
: > substring => sub {for (0..length($x) - 1){$q = $_ }} This one isn't getting the characters from the string, it's just counting from zero to one less than the length of the string. -- tdk

Re: Formular

2001-05-03 Thread Timothy Kimball
: I have a formular with 3 text input fields ( name, fullname, and street ) : and 2 submit buttons.The first submit button start a perl-script "work.pl" : and the second submit button start an another perl-script "checkup.pl" : Now, I don't know, how to make one formular with 2 submit buttons, w

Re: to have URL's call

2001-05-03 Thread Timothy Kimball
: How can I have the URL which is calling my script? : : ex: : the name of my script is : "script.cgi" : URL is : http://www.computer.com/script.cgi?toto=12&titi=25 : I want to have $var=toto=12&titi=25 or $var=http://iti=25 . I think this would be web-server/platform dependent, but under

Re: Nested Hashes Help

2001-05-04 Thread Timothy Kimball
: Now the only way I have figured out how to access it is with this ugly : string: : print "${%{$self{DF_SPEC}}}{'a'}\n"; Try print "$self->{DF_SPEC}{a}\n"; -- tdk

Re: Need help with forms and files

2001-05-04 Thread Timothy Kimball
: I am trying to append to an existing database and my cgi keeps coming up : with an Internal Server Error. I've looked this over many times with : different books as references, and I can't see what is wrong with it. My : form method is POST. Here is my code: My money's on you not being able to

Re: Hash help

2001-05-04 Thread Timothy Kimball
: I declare my hash like this: : : my ( %FS_XCPTN ); # hash table, key is mount point, : # value is FS's special case H_LIMIT and : C_LIMIT : : I use it like this: : $FS_XCPTN{$mntPoint} = { :

Re: filehandle question

2001-05-04 Thread Timothy Kimball
: is it possible to open a filehandle on a file change one line in that file : without outputing to another file. You can open the file, seek() to a particular position in it, and start overwriting the file at that position, but when you reach the end of that line, you'll keep on writing past it

Re: Environment variable question

2001-05-04 Thread Timothy Kimball
: I am required to modify an Environment variable from one value to another : using perl script. I can access the env. variables in the perl : script using ENV. How can i modify so that when I exit my perl script -- the : env. variable has new value. You can't. Perl scripts are child processes o

Re: More hash trouble

2001-05-07 Thread Timothy Kimball
: $self->{DF_SPEC} = { : ... : c => "$self->{DF_SPEC}{a} ...", : : }; : : print "$self->{DF_SPEC}{'b'}\n"; : print "$self->{DF_SPEC}{'h'}\n"; : : : Produces the output: : (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) : : : Any ideas ? You're trying to use parts of the $se

Re: More hash trouble

2001-05-07 Thread Timothy Kimball
: >Would it also be wise to use the qr// ? : > : >Such as: : >my $shortDayName = qr/(Mon|Tue|Wed|Thu|Fri|Sat|Sun)/; : > : >then for example I could do: : >my $abcXYZ = qr/$shortDayName ABC/; : : You don't need to use the ()'s in the regex if you don't plan on capturing : anything, by

Re: scalar vs. vector context

2001-05-07 Thread Timothy Kimball
:@possWords = push(@possWords,$temp) ; This line is the problem. push() returns the number of elements in the array after the new elements have been pushed onto it. Get rid of the "@possWords = " part of this line. -- tdk

Re: Parsing a string....

2001-05-07 Thread Timothy Kimball
: I have thought about tackling this using the regexp (%\w) using the : grouping and getting each match with $n (where n is a number) but I can't : seem to get the regexp to match more than the first match. Have you tried using the "g" regex option? e.g., /.../g -- tdk

Re: nested each(%hash) question

2001-05-08 Thread Timothy Kimball
: I have 2 hashes, %one and %two. : : the ($key, $value) of %one is a span of time. : : I need to compare this span of time over every $key of %two. : : Here's what I have: : : while (($key1, $val1) = each (%one)) { : : while (($key2, $val2) = each (%two)) { : : if (($ke

Re: nested each(%hash) question

2001-05-08 Thread Timothy Kimball
: > I have 2 hashes, %one and %two. : > : > the ($key, $value) of %one is a span of time. : > : > I need to compare this span of time over every $key of %two. : : ... : : Look at the replies given here earlier. : I ran some benchmarks with while and grep, and your while loop didnt look : less e

Re: mv'ing a file from within perl (w/out /bin/mv)

2001-05-09 Thread Timothy Kimball
: I just want an efficient mv subroutine or module which has such a thing, : but none of the File::* things seem to have mv. perldoc -f rename -- tdk

Re: Loading extra modules.

2001-05-09 Thread Timothy Kimball
: Folks, how do I load extra modules? I got Date::Manip today, and I know I : should be putting it in the search-path of perl (@INC ?), but how do I do : it? Can I get a small code snippet? : : I do not have su privileges on the machine I work, and would like the : search-path to have my module

Re: Loading extra modules.

2001-05-09 Thread Timothy Kimball
: Apparently, even if I give PREFIX= as a command line param, you get the : following errors: : Skipping /home/tir/COMP/perl/modules/lib/site_perl/5.005/Date/Manip.pod (unchanged) This means that Perl didn't bother to install Manip.pod because there was one already there that was exactly the s

RE: Loading extra modules.

2001-05-09 Thread Timothy Kimball
: > perl Makefile.PL : : make : : > make test : > make install {su'ed to root} When you do "make test" and you haven't done "make", "make" will be done automatically. -- tdk

Re: How to read the second column of a file

2001-04-20 Thread Timothy Kimball
: I need to read a huge two column file; I only need the : data from the second column; I need to asign it a : variable to that column, for example $FILE, how do go : about doing this; I appreciate your help. How about: while (<>) { $FILE = (split)[1]; ... } "split" by itself s

Re: Breaking up a file.

2001-05-14 Thread Timothy Kimball
: my @sections = split /\n(?=[a-z])/i, $dat; : I have a doubt here. perldoc -f split says, : -- : If the PATTERN contains parentheses, additional array : elements are created from each matching substring in the : delimiter. : : split(

Re: Perplexing problem.........probably beginners luck??

2001-05-15 Thread Timothy Kimball
: Why does reading into a variable instead of $_ make a difference? : Why does the read for the date work with $_ just fine?? In the second example, change ; to $_ = ;. The angle operator only assigns the next line to $_ when it's the only thing in the conditional of a while() statement. As a

Re: foo bar?

2001-05-16 Thread Timothy Kimball
: Maybe a silly question but where does foo-bar or foobar refer to? : : Everyone uses it in perl, but I cannot find the origin of it. See the entry in the Hacker Jargon file: http://www.tuxedo.org/~esr/jargon/html/entry/foo.html -- tdk

Re: help with arrays

2001-05-17 Thread Timothy Kimball
: the above works fine and dandy (I think) : but when I replace the print in the for() with a system call as such : system "mminfo -a -r \"volume,mediarec,ssid,name\" -q \"location=sun_etl\" : -V -o tR -c $_ >> out"; : I get a broken pipe and the output from the mminfo command is spewed on the :

Re: Re[2]: flush - ?

2001-05-18 Thread Timothy Kimball
: I'm sorry, I might sound lame, but these buffering and autoflush problems seem a :bit(?) theoretical and far-fetched to me. Would you please show me examples of :situations (or links to codes) where the use of autoflush instead of buffering IO (or :vice versa) would be crucial. One area is

Re: elegant REGEX

2001-05-18 Thread Timothy Kimball
: can any one suggest me a REGEX to catch the numbers in the following : input line: : test case total : 32456 allocated : 12000 from tech : : I want to catch the two numbers and insert them to vars Elegant? Regex? ;) $line = 'test case total : 32456 allocated : 12000 from tech'; ($n1,$n2) =

Re: Quick rounding to nearest integer

2001-05-18 Thread Timothy Kimball
: Is there an easier way (or more efficent). This is more a curiosity than : anything else. Easy and efficient, as long as $archives_needed is always positive: $archives_needed = int($archives_needed + 0.5); Otherwise, if $archived_needed can be negative: $archives_needed = int($archives_nee

Re: Counting and sorting an array

2001-05-18 Thread Timothy Kimball
: I would like to sort an array like this : my @pets = {$cat, $dog,$camel,$camel,$camel,$dog} : and then to have it printed out in the order of occurrences : print "I will give you <3> camels, <2> dogs, <1> cat " for the blond one Well, first of all, what you have there isn't really an array.

Re: Counting and sorting an array

2001-05-18 Thread Timothy Kimball
Slight correction: : pushd @petcounts, sprintf "<%d> %s%s", should be push @petcounts, sprintf "<%d> %s%s", -- tdk

Re: Quick rounding to nearest integer

2001-05-18 Thread Timothy Kimball
Jos Boumans said: : try to take a look at the 'floor' and 'ceil' in the posix module : : they will do exactly what you want! Not quite. They don't round, they truncate: round floor ceil 10.010 10 10 10.210 10 11 10.711 10 11 Now Craig said: : I have an nu

Re: problem with environment variable

2001-05-18 Thread Timothy Kimball
: $hostadd = $ENV{REMOTE_HOST}; : : print "Host : $hostadd\n"; : : But it isnt working , all I see is : : Host: Your server (I'm assuming Apache) may be configured with: HostnameLookups Off If this is the case, then the server will not try to resolve IP addresses into hostnames. This i

Re: copying an array

2001-05-18 Thread Timothy Kimball
Edson Manners wrote: : I'm currently copying two 1-dimensional arrays using : for loops. Is there an easier way as this may tag my : cpu due to the huge numbers I am using. @copyOfArray = @array; is the usual way to copy arrays. Question., though: Is it absolutely necessary to copy the arrays f

Re: script review

2001-05-18 Thread Timothy Kimball
Ronald J. Yacketta wrote: : Do you mind if I post a script I have been hacking away at for a week or so : now? hmmm, an online code review. Sounds like Open Source. ;) Yeah, post it. -- tdk

Re: REVIEW: please review the following

2001-05-18 Thread Timothy Kimball
212 open(RPT, ">>$REPORT") or die "Can't open $REPORT: $!"; ... 221 system "echo \"Starting WKI clone process for $DATE on `date`\" >> $REPORT"; So you open $REPORT for appending, and then echo into it? Why open it in the first place? Also, it seems a bit risky, especially since the

Re: passing array values into a command string

2001-05-18 Thread Timothy Kimball
Jason wrote: : while () {# read the names into a hash : $names{$_} = 1; : } Maybe do a chomp() in here? while () { chomp; $names{$_} = 1; } Otherwise, it might be trying to match the newline (which Perl retains). -- tdk

Re: Version from Apache

2001-05-21 Thread Timothy Kimball
: How I get the version from apache?? Try $ENV{SERVER_SOFTWARE}. If you're using mod_perl, there's a SERVER_VERSION in Apache::Constants. -- tdk

Re: Beginner question

2001-05-21 Thread Timothy Kimball
: if ($oldLot[1] == 0) : { : $arpCount = $arp{$lot}; ==> Part 1 : } : else : { : $arpCount = "-"; ==> Part 2 : } : : printf "%3s %3d ", $arpCount, $count; : : My problem occurs in the "printf" at the "%3s". Here : is the situation: When $oldLot[1] == 0, $arpCount is : equal to

Re: using GET and parsing content.

2001-05-21 Thread Timothy Kimball
Jeff wrote: : open(DOM, GET 'http://URL') || "unable to open website\n"; : : The GET here doesn't actually get the results it just dumps the : main URL not the results. If you're using the GET method from HTTP::Request::Common, then that's all it will return, the URL. It's encapsulates the requ

Re: Help with CGI script

2001-05-21 Thread Timothy Kimball
Damien wrote: : ... : So here are the files, and I home someone can help :) : ... It would be a lot more useful if you could get the error message in your server's error log. Find out where this is and tattoo that location on the inside of your eyelids. The error log is a CGI programmer's best f

Re: Help with CGI script

2001-05-21 Thread Timothy Kimball
Damien wrote: : open ARTICLE, "$bkup_dir/$artid.data" or die "Could not open article data file :$bkup_dir/$artid.data: $!\n"; By the way, if the die() message doesn't end in a newline, then die() will tell you what line of what script it died on. This is invaluable for debugging. -- tdk

Re: use lib directive

2001-05-21 Thread Timothy Kimball
Peter Cline wrote: : Hello, I am attempting to develop my first module. Because of : permissions/security, etc.. I cannot store the module in the standard perl : lib directories. So it is currently living in a subdir called lib in my : home directory. I use a "use lib" directive to add thi

Re: use lib directive

2001-05-21 Thread Timothy Kimball
I wrote: : If you did, then did you use the same perl executable to install the : module that you're using to run it? i.e., does 'which perl' eq the : shebang line of your script? If you have two perls on your system : (seems a lot of people do), then it may be that the other module isn't : inst

Re: Form processing - redirect?

2001-05-21 Thread Timothy Kimball
Gary Madden wrote: : In response to a user filling out and submitting a form, I want to send : the user an HTML page whose URL I've stored as a hidden value on the : forms page instead of creating the page within the cgi script. (The : other functions of my script work properly.) This way the pag

Re: Dynamic regular expressions

2001-05-22 Thread Timothy Kimball
Robin Lavallee wrote: : On the command lines, the following happend : : allo al => match : allo /al/ => no match (should match, no ?) No, because "allo" doesn't contain any slashes. : allo lo$ => match : allo ^al => match : allo ^ao$

Re: Multiple submit buttons CGI question

2001-05-22 Thread Timothy Kimball
Dave wrote: : Can any one tell where I went wrong here? : (I remember reading that a html form can have : multiple submit forms as long as you parse them : via their value) : ... : In the html: : These tags need a name attribute. Without it, the values will not be bound to a CGI parameter nam

RE: Multiple submit buttons CGI question

2001-05-22 Thread Timothy Kimball
Aaron Craig wrote: : I believe multiple submit buttons only send off the information for the : form they are a part of. If you have multiple forms, clicking one submit : button will only get you that form sent off. This is true (unless you're into Javascript). However, a single form can have

Re: Passing command line arguements

2001-05-22 Thread Timothy Kimball
Dan Brown wrote: : If it really is a script written for cgi, sending arguments via command : line won't work. When a cgi script runs information is available to : that script because the web server provides an environment from which : the script can access the information. If the script is writ

Re: Require

2001-05-22 Thread Timothy Kimball
john wrote: : It seems like using 'require' is the way to go (since I don't have the time or : experience to do modules at the moment). : : I can get the required scripts and subroutines to call OK when there is only one : sub per required file and I don't have to pass arguments. : : When I try

Re: psgrep from Perl Cookbook

2001-05-23 Thread Timothy Kimball
Ron Yacketta wrote: : I finally got a few books from O'Reilly, I truly am enjoying reading "Perl : Cookbook" : I was wondering if any of these complete scripts are available online for : download? All the examples from the book are available as a .tzr.gz or .zip file from http://examples.oreilly

Re: Regular Expressions

2001-05-23 Thread Timothy Kimball
Stefan Kyrytow wrote: : As you can see the last two inputs should not be accepted. I am using $x =~ : /[0-9]/ as my filter. I understand why the values are being accepted, I am : searching for a number and 12bob & bob12 each contain a number. : : What I do not understand is how to search for jus

Re: New line in Regular expression.

2001-05-23 Thread Timothy Kimball
: this is what i tryed on the command prompt. : : perl -pi -e 's{^

Re: Regrex question

2001-05-23 Thread Timothy Kimball
: ### Does not work want to count the number of matches... : $regex= ($test=~ s/(dav)/$i++ $1/eig); : : print "$regex $i\n"; : : ### This does work.. : $regex= ($test=~ s/(dav)/$1 Smith/ig); : : print "$regex\n"; : : __END__ : : : It looks like $regex contains the number of matches,

Re: New line in Regular expression.

2001-05-23 Thread Timothy Kimball
japhy wrote: : On May 23, Timothy Kimball said: : : >2. Use the "s" modifier to treat the slurped-up file as a single string. : : The /s modifier changes the meaning of . only, and not ^ or $ -- see my : response. I stand corrected. In my defense, I don't use either of the

Re: $! after using backticks

2001-05-23 Thread Timothy Kimball
Ron Mitchell wrote: : I want to check that a backtick command has executed OK. I thought I could : do that by looking at the $! variable. Check $? instead. This one's for pipes, backticks, & system() commands. It's a fairly complex flag, with a lot of stuff in it, but briefly, $? >> 8 contains t

Re: Problems with split

2001-05-24 Thread Timothy Kimball
Andy Roden wrote: : For some reason, the script doesn't execute the split as I would hope : (giving $router_table{i} = 1.1.1.1 $router_type{i} = cisco) it just : returns two blanks (and hence prints out the $router_tables{$i} as its : told to Should be $router_table{$i}, shouldn't it? -- tdk

Re: Is there an alternative to #!/usr/bin/perl

2001-05-24 Thread Timothy Kimball
: I'm writing perl scripts that will be distributed to locations where I : cannot gaurantee the location of perl. Is there a clean alternative to the : shebang with the specific perl path? Maybe using an environment variable to : locate perl? This may be a heavier solution than you were looking

Re: Why can't $I = chop $array[1]

2001-05-24 Thread Timothy Kimball
David Blevins wrote: : I'm wondering, why can I do this: : : local @fileList = reverse sort `ls $list*.list`; : local $current = $fileList[0]; : local $previous = $fileList[1]; : : chop $current; : chop $previous; : : But, not this: : local @fileList = reverse sort `ls

Re: Problems with split

2001-05-24 Thread Timothy Kimball
: what should be $router_table{$i} ? Sorry for the typo. Should be $router_tables{$i}. In the code you posted, you don't have a dollar sign on the i. -- tdk

Re: Why can't $I = chop $array[1]

2001-05-24 Thread Timothy Kimball
Me wrote: : > n.b. chop() removes the last character; chomp() removes the last : > character only if it's a record separator (defined in $/). Either one : > will return the character chopped. : : Nah, chomp() returns number of chars dropped. You're right. I just get tired of looking everything

Re: Is there an alternative to #!/usr/bin/perl

2001-05-24 Thread Timothy Kimball
Neville hobson wrote: : I'm writing perl scripts that will be distributed to locations where I : cannot gaurantee the location of perl. Is there a clean alternative to the : shebang with the specific perl path? Maybe using an environment variable to : locate perl? OK, here's one solution, extrac

Re: Is there an alternative to #!/usr/bin/perl

2001-05-24 Thread Timothy Kimball
Stephen Neu wrote: : ... Otherwise, you have code that needs to : find Perl so it can run the code that needs to find Perl so it can run the : code that needs to find Perl so it can... etc. Or you can run "perl" on a fixer script and have it edit the script for you. That's what my solution doe

Re: pop up alert

2001-05-24 Thread Timothy Kimball
Sigrid Kelsey wrote: : I would like an alert to pop up everytime someone accesses a certain cgi : script (I'm new at this). I have commented out my lame attempts that don't : work below, but I think they will show what I'm trying to do. : : #! /usr/sbin/perl : : #print " : # alert('MESSA

Re: Modifying/Deleting lines in a file

2001-05-24 Thread Timothy Kimball
David Blevins wrote: : There has to be a better way to modify/delete lines in a file than this. Time for a one-liner: perl -ni -e 'print unless /I'm a bad line, delete me\./' thefile -n loops through the lines of thefile, but doesn't print them unless you ask -i edits thefile in place -e mea

Re: NDBM Error

2001-05-25 Thread Timothy Kimball
Geraint Jones wrote: : "ndbm store returned -1, errno 0, key "C4842AE" at : /usr/local/httpd/cgi-bin/ism-web.pl line 49." : : This is the offending line: : : $STOCK{$act_on} += $val; Does the user that your CGI script runs as have write permission on the dbm file? -- tdk

  1   2   3   4   5   6   7   8   9   10   >