Re: formatting the loop

2004-02-11 Thread James Edward Gray II
On Feb 11, 2004, at 1:27 PM, Michael S. Robeson II wrote: [snip] Anyway, though it works great I am having a tough time trying to figure out WHY it works. See comments below, in the code. [snip] I think if I can understand the mechanics behind this script it will only help me my future unders

Re: formatting and syntax

2004-02-11 Thread James Edward Gray II
(redirected to Perl Beginners by James) On Feb 11, 2004, at 10:34 AM, Michael S. Robeson II wrote: Hey, thanks again for the perl code. You're welcome, but let's keep our discussion on the mailing list so we can all help and learn. However, I forgot to take into account that the original input

Re: Array containment

2004-02-11 Thread James Edward Gray II
On Feb 11, 2004, at 9:23 AM, Jan Eden wrote: James Edward Gray II wrote: Now it might be hard to determine which of these two is faster. And the results, from my G5: Benchmark: timing 300 iterations of all_ones, foreach, hash_slice, map_hash, map_ones, range... all_ones: 1 wallclock

Re: Array containment

2004-02-11 Thread James Edward Gray II
On Feb 11, 2004, at 12:14 AM, Jan Eden wrote: James Edward Gray II wrote: On Feb 10, 2004, at 2:39 PM, Jan Eden wrote: Rob, I read the perlfaq paragraph you mentioned and found that it proposes a solution which does not make use of 'exists': What's wrong with exists()? I li

Re: RFC - implementing callbacks

2004-02-10 Thread James Edward Gray II
On Feb 10, 2004, at 3:29 AM, Gary Stainburn wrote: Hi folks, Hello again. [snipped history] One of the points made in the previous threads was that there should be no need for sub-classes to have a link back to it's parent, and through the correct splitting of functions (inter-instance in clas

Re: Perl Documentation like Javadoc

2004-02-10 Thread James Edward Gray II
On Feb 10, 2004, at 2:51 PM, Viraj Purang wrote: I would like to generate methof/subroutine related documentation for a Perl project that I have just finished. What is the best way of doing it ? can you also specify which commands/executables to use for this ? Perl's Javadoc-like cousin is called

Re: Array containment

2004-02-10 Thread James Edward Gray II
On Feb 10, 2004, at 2:39 PM, Jan Eden wrote: James, Rob, Japhy, I am impressed, really. Thank you! Me too. We haven't scared you off yet. :) Impressive. Rob, I read the perlfaq paragraph you mentioned and found that it proposes a solution which does not make use of 'exists': What's wrong wit

Re: Getting croak or carp into variable ?

2004-02-10 Thread James Edward Gray II
On Feb 10, 2004, at 11:53 AM, Dan Muey wrote: perl -MCarp -e '$SIG{__WARN__} = sub { $err = shift; }; carp "Error!\n"; print "We caught $err";' This works great! And changing $SIG{__WARN__} to '' will return default behaviour correct? (Same thign with __DIE__ ??) Just undef them: undef $SIG{__W

Re: Array containment

2004-02-10 Thread James Edward Gray II
On Feb 10, 2004, at 11:20 AM, Rob Dixon wrote: James wrote: On Feb 10, 2004, at 5:04 AM, Jan Eden wrote: Now I found a nicer solution in "Learning Perl Objects, References & Modules" and adapted it: sub contains { my $contained = shift; my $result = grep { $contained eq $_ } @_; } Again,

Re: Getting croak or carp into variable ?

2004-02-10 Thread James Edward Gray II
On Feb 10, 2004, at 9:56 AM, Dan Muey wrote: Hello List, I am using a module that does use Carp; and you can specify whther you want croak or carp on an error Which is cool. But there is no way to specify anythign else besides those two. So the way it is you just do: my $res = funktion('foobarmo

Re: How to interrogate array cell?

2004-02-10 Thread James Edward Gray II
On Feb 10, 2004, at 8:50 AM, Richard Heintze wrote: I have an array of hashes. What function should I be using to interrogate each array cell when I want to know if it is occupied? "exists" seemed to do the job nicely. What about "defined"? exists() tests if the slot was ever assigned to. defin

Re: Date manipulation

2004-02-10 Thread James Edward Gray II
On Feb 10, 2004, at 4:21 AM, Roger Grosswiler wrote: hi list, Hello. i'd like to try a first perl-script that should: -define todays date print localtime(), "\n"; -define todays date minus one week print localtime( time - 60 * 60 * 24 * 7 ), "\n"; # depending on how you define "week" -find in

Re: Array containment

2004-02-10 Thread James Edward Gray II
On Feb 10, 2004, at 8:53 AM, Jan Eden wrote: Rob Dixon wrote: @[EMAIL PROTECTED] = (); I see. But shouldn't the last line be a complete hash slice: [EMAIL PROTECTED] = (); Rob's line is a hash slice. Note the @. Yours is a simple hash lookup, one scalar value affected, thus the $. James -

Re: Array containment

2004-02-10 Thread James Edward Gray II
On Feb 10, 2004, at 5:04 AM, Jan Eden wrote: Hi all, Howdy. a while ago, I wrote a little subroutine to test wether a given element is in a given array: sub contains { my $result = 0; my $contained = shift; foreach (@_) { if ($_ eq $contained){ $result = 1; } } $res

Re: Method invocation arrow (LPORM)

2004-02-08 Thread James Edward Gray II
On Feb 8, 2004, at 6:51 AM, Randy W. Sims wrote: Hmm, I think a good exercise would be to write code snippets to demonstrate the differences between the four method calls: Package::method() Is this really a "method call"? I think of it as a package qualified subroutine call. $class->method()

Re: Method invocation arrow (LPORM)

2004-02-07 Thread James Edward Gray II
On Feb 7, 2004, at 2:20 PM, Jan Eden wrote: Yes, SUPER:: is introduced just two paragraphs later. I read on, but the uncertainty about $class->Animal::speak kept bugging me. ;) Excellent. I figured that was the case, but I was just making sure. James -- To unsubscribe, e-mail: [EMAIL PROTECTED

Re: Script Kiddie issues

2004-02-07 Thread James Edward Gray II
On Feb 7, 2004, at 11:37 AM, Wiggins d'Anconia wrote: Securing your system from someone is different than firing back. And your house analogy is really dumb, it has predefined borders that are very distinct. Your webserver is open and you are inviting someone to look at anything on it, for the

Re: Method invocation arrow (LPORM)

2004-02-07 Thread James Edward Gray II
On Feb 7, 2004, at 10:02 AM, Jeff 'japhy' Pinyan wrote: On Feb 7, Jan Eden said: { package Mouse @ISA = qw{Animal}; ... sub speak { my $class = shift; ... Animal::speak($class); ... } } I was about to ask why it's written this way, but upon checking the source, I see

Re: * CSV to HTML * zero reads as empty space

2004-02-05 Thread James Edward Gray II
On Feb 5, 2004, at 1:34 PM, Gregg O'Donnell wrote: Here's the whole shootin' match... Wow, man. No offense intended but we need to clean that up a little before I can say a lot about how it is or is not working. Did you know we won't bill you for using extra whitespace? First two questions:

Re: * CSV to HTML * zero reads as empty space

2004-02-05 Thread James Edward Gray II
On Feb 5, 2004, at 11:56 AM, Gregg O'Donnell wrote: Good follow-up, and here's a snippet: Just FYI, there are multiple CSV parsing modules on the CPAN. I use Text::CSV_XS personally. sub parse_line { my $line = shift; chomp($line); print "LINE: $line\n" if $debug; my %record; my $entr

Re: * CSV to HTML * zero reads as empty space

2004-02-05 Thread James Edward Gray II
On Feb 5, 2004, at 10:38 AM, Gregg O'Donnell wrote: I have a script that reads a CSV file into an HTML template. The template reads the CSV data accurately unless the field shows zero, in which case the HTML page displays a blank space. Any suggesstions? Absolutely. I suggest you post your code

Re: symbolic references

2004-02-04 Thread James Edward Gray II
On Feb 4, 2004, at 4:19 PM, David Byrne wrote: Okay, sorry to be somewhat unclear with my question. Here’s some sample input data that may help to clear things up: See if this gets you going. It's one possible answer. James #!/usr/bin/perl use strict; use warnings; use Data::Dumper; my $tree

Re: symbolic references

2004-02-04 Thread James Edward Gray II
On Feb 4, 2004, at 1:38 PM, David Byrne wrote: Greetings, Hello. I’m trying to generate a tree of nested hashes [of an arbitrary size]. I'm trying to run the code you posted, so I can see what the heck is going on. That's not going well for me either.My processor usage spikes through the r

Re: formatting and syntax

2004-02-04 Thread James Edward Gray II
On Feb 4, 2004, at 11:35 AM, Michael S. Robeson II wrote: Hi I am all still to new to PERL and I am having trouble playing with formatting my data into a new format. So here is my problem: I have data (DNA sequence) in a file that looks like this: # Infile >bob AGTGATGCCGACG >fred ACG

Re: Uploading a CSV file to a Database Table

2004-02-04 Thread James Edward Gray II
On Feb 4, 2004, at 11:24 AM, Mark Martin wrote: hmmm..bit over my head I'm afraid. What was over you head? What I showed, or building an SQL statement and feeding it to the DBI? I've tried a different tack that maybe you can help me with. It's quite possible that I will be forced to take th

Re: In what order does a program run..??

2004-02-04 Thread James Edward Gray II
On Feb 4, 2004, at 12:11 PM, Rob Dixon wrote: Wiggins D Anconia wrote: I'm new to PERL and am trying to learn by reading some PERL programs. Perl or perl, never PERL. perldoc -q '"Perl"' Only on Unix: perldoc "What's the difference" I believe you missed a -q in there: perldo

Re: In what order does a program run..??

2004-02-04 Thread James Edward Gray II
On Feb 4, 2004, at 9:52 AM, <[EMAIL PROTECTED]> wrote: I'm new to PERL and am trying to learn by reading some PERL programs. Welcome then. Look's like you already got your answer, but here's a tip: "perl" refers to the program that compiles and runs programs written in the "Perl" programming l

Re: Uploading a CSV file to a Database Table

2004-02-04 Thread James Edward Gray II
On Feb 4, 2004, at 6:50 AM, Mark Martin wrote: I'm pulling my hair out trying to find out how to upload this data. My files can vary in numbers of rows and columns but the x and y axis always contain the same type of metadata - in my case cost centre and cost item. A sample of the data would lo

Re: Help with files

2004-02-03 Thread James Edward Gray II
(redirected to Perl Beginners by James) Begin forwarded message: From: "Marcelo" <[EMAIL PROTECTED]> Date: February 3, 2004 1:56:20 PM CST To: "James Edward Gray II" <[EMAIL PROTECTED]> Subject: Re: Help with files Found the way to delete duplicates on an array (

Re: Help with files

2004-02-03 Thread James Edward Gray II
On Feb 3, 2004, at 1:06 PM, Marcelo wrote: Hi everyone, need help with two things; how do you find out if a line is duplicated in a file, and delete it if so. how do you delete a line if it has more than x number of characters. What have you tried? Post some code, show us where you are stuck a

Re: comparing array value...

2004-02-03 Thread James Edward Gray II
On Feb 3, 2004, at 7:59 AM, Singh, Ajit p wrote: Hello there, could somebody let me know how do i compare the contents of an array that I have... To be specific. my array contains something like below and i need to compare whether the string "interface ATM2/0.10 multipoint" exists in my array.

Re: Need help sorting by specific fields in file.

2004-02-02 Thread James Edward Gray II
On Feb 2, 2004, at 1:49 PM, Dennis G. Wicks wrote: Greetings; I have a file that I need to sort and currently I am just sorting it by @datalist = sort(@datalist); Okay, but you're not sorting a file there. You're sorting an array. Maybe that array was loaded from a file, but we're dealin

Re: (U) Oracle clustering on Linux/Intel based Platforms with a SAN ....

2004-02-02 Thread James Edward Gray II
On Feb 2, 2004, at 11:42 AM, Johnson, Michael wrote: CLASSIFICATION: UNCLASSIFIED Just a very broad open question on anyone using this set up for their enterprise system. I am looking into setting something like this. I have seen much of the research so I am interesting in opinions and expe

Re: Perl 6

2004-02-02 Thread James Edward Gray II
On Feb 1, 2004, at 5:43 PM, Dan Brow wrote: Any one know when perl 6 will be released for production use? Perl 6 is still largely in the design phase. However, if you're looking for a certain functionality with Perl, are you sure Perl 5 doesn't do what you need? James -- To unsubscribe, e-mail

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: What is eval?

2004-01-29 Thread James Edward Gray II
On Jan 29, 2004, at 6:26 AM, Mallik wrote: Can anybody explain the functionality of eval in brief? perldoc -f eval James -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Subroutine interaction

2004-01-29 Thread James Edward Gray II
On Jan 29, 2004, at 2:18 AM, Jan Eden wrote: I am not sure if I could store all this in one hash: I bet you can. I'm an optimist. ;) I haven't been following this thread too closely, but let's just think about it in the general sense. What you basically has is a lot of information about spec

Re: [OT] Linux VPN server / Mac windows clients | perl on a Mac editors

2004-01-29 Thread James Edward Gray II
On Jan 29, 2004, at 9:08 AM, Jan Eden wrote: And you get Perl 5.8.2 with any new Mac (with Mac OS 10.3, that is)! Sorry to nit pick, but Mac OS X 10.3 comes with Perl 5.8.1-RC3 compiled with threading options. James -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [

Re: [OT] Linux VPN server / Mac windows clients | perl on a Mac editors

2004-01-29 Thread James Edward Gray II
On Jan 29, 2004, at 8:19 AM, Paul Kraus wrote: What are some decent perl Mac editors? For my money, BBEdit is the best software investment I ever made. http://www.barebones.com/ I love emacs but it seems so far I am only able to run it under a terminal window. I like how everything in Mac uses

Re: error but code works

2004-01-29 Thread James Edward Gray II
On Jan 29, 2004, at 8:07 AM, Gary Stainburn wrote: Hi folks, I've got the following code which works, but generates the error message following it. I've tried varying the code to eliminate the error but I only manage to get either the working code with error or non-working code without error.

Fwd: Perl Query

2004-01-28 Thread James Edward Gray II
(redirected to Perl Beginners by James) Begin forwarded message: From: atul ashpalia <[EMAIL PROTECTED]> Date: January 28, 2004 4:18:13 AM CST To: [EMAIL PROTECTED] Subject: Perl Query hi there, i am a beginner in perl and have done some basic exercises in perl covering fundamentals, references,

Re: How to calculate elapsed time ?

2004-01-28 Thread James Edward Gray II
On Jan 27, 2004, at 6:50 PM, [EMAIL PROTECTED] wrote: Hi all: Howdy. I'm trying to determine how long an system operation takes. Anyone know of a simple way to do this ? You were on the right track. Try this: my $start = time; # do something to time here my $time_taken = time - $start; If

Re: function that reads line numbers?

2004-01-28 Thread James Edward Gray II
On Jan 27, 2004, at 8: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 range of lines you gave it? My other alterna

Re: How to calculate elapsed time ?

2004-01-28 Thread James Edward Gray II
On Jan 27, 2004, at 6:50 PM, [EMAIL PROTECTED] wrote: Hi all: Howdy. I'm trying to determine how long an system operation takes. Anyone know of a simple way to do this ? You were on the right track. Try this: my $start = time; # do something to time here my $time_taken = time - $start; If

Re: simple probability problem using PERL

2004-01-24 Thread James Edward Gray II
On Jan 24, 2004, at 5:31 PM, Charles Lu wrote: Hi If I want to randomly generate a dice (4 side) roll, I can use the following expression: $roll = 1 + int( rand(4)); This assumes that every side of this dice has equal chance of being rolled (0.25). Thats easy. Now What if I say, that th

Re: modules and _DATA_

2004-01-23 Thread James Edward Gray II
On Jan 23, 2004, at 3:27 PM, Eric Walker wrote: I have some code I want to add a package in the same file. I already have some _DATA_ in the file. Currently, the code is not seeing the _DATA_. How can I add a package in the same file then. I believe your DATA tag at the end is the problem. It'

Re: Survey : Max size allowable for slurping files

2004-01-22 Thread James Edward Gray II
On Jan 22, 2004, at 4:12 PM, Tim Johnson wrote: Here's another argument against slurping: When you slurp a file all at once, even if your program isn't using up much of the CPU, on many machines it will slow down performance considerably if you slurp a large file (large, of course, is still some

Re: Survey : Max size allowable for slurping files

2004-01-22 Thread James Edward Gray II
On Jan 22, 2004, at 12:18 PM, Dan Muey wrote: There are always comments like "you can slurp the file as long as it's not too big" or "becareful not to slurp a really big file or you'll be in trouble". So what I'd like to survey is what would be what the safest max size of a file that one should ev

Re: Calling SUPER::constructor in the constructor

2004-01-22 Thread James Edward Gray II
On Jan 22, 2004, at 11:13 AM, Dan Anderson wrote: Is it possible to call the constructor that a function inherits from its parent? Yes. I tried calling SUPER:: and SUPER-> in a constructor and got errors. sub new { my $class = shift; my $self = $class->SUPER::new(@_); # .

Re: search an replace

2004-01-22 Thread James Edward Gray II
On Jan 22, 2004, at 10:13 AM, rmck wrote: Hi Hello. This scripts sucks in a 109mb file and i'm trying to do a search and replace on unxtime to the format from strftime. Which is working... But I run this system call and it took allnight to run :( So I killed it... Any other suggestions to rea

Re: Learning to use map and grep

2004-01-22 Thread James Edward Gray II
On Jan 22, 2004, at 8:24 AM, Paul Kraus wrote: This is a simple bit of code that scans through a file and determines the width setting for columns that will eventually be written out using spreadsheet::writexcel. It works fine but I am curious if there is a way to do it with map or grep that wo

Re: Reg Ex help...

2004-01-20 Thread James Edward Gray II
On Jan 20, 2004, at 4:28 PM, Lewick, Taylor wrote: Thanks to everyone's help so far, I think I am getting better with Regular expressions... Need a little help on this one This is sample data, not accurate.. 1. St Joes (15-0) .875 (2-0) 2. Kentucky (12-2) .850 (1-0) 10. Kansas (12-2)

Re: counters for lines

2004-01-20 Thread James Edward Gray II
On Jan 20, 2004, at 2:52 PM, Anthony J Segelhorst wrote: James Edward Gray II <[EMAIL PROTECTED]> 01/20/2004 02:11 PM I got this script written from James gave me: Right here you left out: use strict; use warnings; While not required, they're and important step in gaining Perl maste

Re: Delete multiple blank lines

2004-01-20 Thread James Edward Gray II
On Jan 20, 2004, at 1:01 PM, Paul Johnson wrote: perl -i~ -p00e0 file1 file2 ... Wow! I've been over here trying to explain to myself why that works. Help me out a little. Broken down those switches are: -i~ -p -00e0 Right? No problems with the first two here. The third sets the input reco

Re: counters for lines

2004-01-20 Thread James Edward Gray II
On Jan 20, 2004, at 12:39 PM, Anthony J Segelhorst wrote: I have the following output, and each value that is separated by comma is a variable: servera,serverb,109,aix4-r1,server servera,serverb,109,aix4-r1,server servera,serverb,109,aix4-r1,server servera,serverb,109,aix4-r1,server servera,serv

Re: Delete multiple blank lines

2004-01-20 Thread James Edward Gray II
On Jan 20, 2004, at 12:39 PM, Lewick, Taylor wrote: Hi all, I could use some help with an expression or code to delete multiple blank lines and replace it with only one blank line... I know how this can be done in sed, but am not sure how to do it in perl... Well, if slurping is okay (read: file s

Re: How to send results to more than one recipient

2004-01-20 Thread James Edward Gray II
On Jan 20, 2004, at 8:47 AM, Sander wrote: James, Thanks for the response but that doesn't seem to work either. Maybe it would be easier just to create a distribution list on the email server and just put that address in my script. That's definitely a way to go. Other choices: Send us the par

Re: Passing Hash table to function?

2004-01-20 Thread James Edward Gray II
On Jan 20, 2004, at 5:09 AM, Tushar Gokhale wrote: Thanks James for your prompt reply and sorry for my poor english. I'll get back to the point to clear the confusion. There are 5 scripts which I'm running and each script has %enumerations with its own values. There is one library where

Re: looping through (a lot of) files

2004-01-19 Thread James Edward Gray II
On Jan 19, 2004, at 4:33 PM, wolf blaum wrote: Hi there, Hello. I do have one type A file, that holds about 25.000 A-ids, one per line. Furher I have 500 type B files in a dir that hold 10-500 B-ids each, one per line. All files are -T Now i want to generate 500 type C files, corrosponding to th

Re: How to send results to more than one recipient

2004-01-19 Thread James Edward Gray II
On Jan 19, 2004, at 3:23 PM, Sander wrote: I have a simple form that I have been using for a while, but now I need to send the data to two email addresses. What is the simplest way to achieve this? I have tried various combinations and can't seem to figure it out. $emailId = '[EMAIL PROTECTED

Re: Relative path

2004-01-19 Thread James Edward Gray II
On Jan 19, 2004, at 10:50 AM, Jan Eden wrote: I imagine you could fix it by upgrading/reinstalling Perl, if you're interested. Can I reinstall Perl (just Perl) from the OS X CDs? Unfortunately, I don't believe you can. Sorry. James -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional com

Re: Relative path

2004-01-19 Thread James Edward Gray II
On Jan 19, 2004, at 9:53 AM, Jan Eden wrote: I always hesitate to use perldoc, since the system is so crippled on my machine. 'perldoc perldoc' does not work, and the whole perlfaq is missing (on OS 10.3). You probably know this, but just to be sure, this is not normal. 'perldoc' works beauti

Re: Relative path

2004-01-19 Thread James Edward Gray II
On Jan 19, 2004, at 6:31 AM, Jan Eden wrote: Hi, I wrote some scripts using File::Find's find function like this find (\&process, $path) I get $path either from the command line or from a default string. Now how can I enable my scripts to deal with relative pathnames? Right now, the script co

Re: Passing Hash table to function?

2004-01-19 Thread James Edward Gray II
On Jan 19, 2004, at 5:26 AM, Tushar Gokhale wrote: I have a hash table which contains values like my %enumerations = ( #mystat mode 'edcf' => '1', 'hcf' => '2', #admin state 'disable' => '0', 'enable' => '1', ); I

Re: Calculations with date

2004-01-18 Thread James Edward Gray II
On Jan 18, 2004, at 5:20 PM, danield wrote: Hello all, I am looking for an advice or suggestion in this task: I do have a Perl script which contains 2 variables ($low, $high). The value assigned to them depends on which day am I running that Perl script. Moreover, the variable $low has always be

Re: Use strict inside module to apply to entire script?

2004-01-18 Thread James Edward Gray II
On Jan 18, 2004, at 12:12 AM, Steve Grazzini wrote: On Saturday, January 17, 2004, at 06:21 PM, Dan Muey wrote: I was curious if it's possible to have a module like so: package Foo:Monkey; use strict; use warnings; You can call "strict->import" like this: package Foo::Monkey; sub import

Re: Use strict inside module to apply to entire script?

2004-01-17 Thread James Edward Gray II
On Jan 17, 2004, at 6:52 PM, drieux wrote: On Jan 17, 2004, at 3:21 PM, Dan Muey wrote: I was curious if it's possible to have a module like so: package Foo:Monkey; use strict; use warnings; Then in my script: #!/usr/bin/perl use Foo::Monkey; No. Try to think about the Issue of Scoping. I c

Re: Why isn't perl used more in business and industry

2004-01-17 Thread James Edward Gray II
On Jan 17, 2004, at 3:51 PM, James Edward Gray II wrote: A recent article on Perl.com covered this a little: http://www.perl.com/pub/a/2004/01/09/survey.html And look what I read on Slashdot today: http://developers.slashdot.org/article.pl?sid=04/01/17/ 1435206&mode=thread&tid=100&

Re: Why isn't perl used more in business and industry

2004-01-17 Thread James Edward Gray II
On Jan 17, 2004, at 3:20 PM, Dan Muey wrote: Of course, that's all just guess work on my part. I'm no expert. On the flip side, I believe Amazon.com uses a mostly Perl system, just to name a familiar name. There has to be others, I would think. Maybe a website listing should be made/found?? A

Re: what is this data structure?

2004-01-17 Thread James Edward Gray II
On Jan 17, 2004, at 2:16 PM, Dan Anderson wrote: On Sat, 2004-01-17 at 15:12, James Edward Gray II wrote: On Jan 17, 2004, at 2:02 PM, Dan Anderson wrote: On Fri, 2004-01-16 at 11:03, Jack Chen wrote: Hi, I don't know how to work with this data structure: my @array = ((a =>

Re: Why isn't perl used more in business and industry

2004-01-17 Thread James Edward Gray II
On Jan 17, 2004, at 1:43 PM, Dan Anderson wrote: Most of the scripts I see end in an extension like .jsp, .asp, .dll, or something which says that they aren't perl. Is there a reason more businesses and online companies don't use perl? In a job interview last year, I was talking to a company who

Re: what is this data structure?

2004-01-17 Thread James Edward Gray II
On Jan 17, 2004, at 2:02 PM, Dan Anderson wrote: On Fri, 2004-01-16 at 11:03, Jack Chen wrote: Hi, I don't know how to work with this data structure: my @array = ((a => 'appple'), (b => 'tree'), (c => 'chair')); That "array" is an array of

Re: Creating My Own Escapes

2004-01-16 Thread James Edward Gray II
On Jan 16, 2004, at 4:43 PM, Tassilo von Parseval wrote: Maybe B::perlstring() will do what you need: [EMAIL PROTECTED]:~$ perl -lMB=perlstring -e '$var = "\n\r\f"; print perlstring( "$var bla\"\\ \n" )' "\n\r\f bla\"\\ \n" I didn't know about that subroutine. Thank you very much! James -- To

Re: Creating My Own Escapes

2004-01-16 Thread James Edward Gray II
On Jan 16, 2004, at 4:22 PM, Mark LoBue wrote: I just had to do something like this yesterday, and I couldn't figure out how to do it in just one regex, but I did find a way that you could use. I have a database giving me single and double quotes in variables as their octal equivalent. I get

Re: Creating My Own Escapes

2004-01-16 Thread James Edward Gray II
On Jan 16, 2004, at 3:38 PM, James Edward Gray II wrote: Now I have to get it back out of the file and that's where it falls apart on me. I've tried things like: $string =~ s/((?:^|[^\\])(?:)*)\\n/$1\n/g; $string =~ s//\\/g; Sorry to reply to my own post, but does this work?

Creating My Own Escapes

2004-01-16 Thread James Edward Gray II
I have a problem I just cant seem to get my head around, so any help is appreciated. I have a string. It could contain anything a Perl string can contain. I have to print this string to a file and later bring it back in exactly as it was. However, because of the file format, the string in t

Re: multiline matching

2004-01-16 Thread James Edward Gray II
On Jan 15, 2004, at 8:30 PM, Kenton Brede wrote: Thanks for the great explanation. I've been working with the code above since I need more hash practice, trying to keep on track with the original poster's question. The code below works fine except I can't figure out how to put one "\n" between

Re: Dumping values of all vars

2004-01-15 Thread James Edward Gray II
On Jan 15, 2004, at 5:06 PM, Dan Anderson wrote: And I agree that Data::Dumper is much more complicated then it needs to be. Data::Dumper is a standard module and I find it super useful. I just showed it in a one liner, so I don't think we can say it's too hard to get into. I encourage others

Re: Dumping values of all vars

2004-01-15 Thread James Edward Gray II
On Jan 15, 2004, at 4:40 PM, Dan Anderson wrote: I use the Data::Dump package which is a standard module. I'm willing to bet you actually use Data::Dumper. Be warned that calling Data::Dump::dump($variable) will undef $variable! Well, Dump() (not dump) is meant to be called as a method and takes

Re: multiline matching

2004-01-15 Thread James Edward Gray II
On Jan 14, 2004, at 10:28 PM, Kenton Brede wrote: On Wed, Jan 14, 2004 at 09:57:51PM -0600, James Edward Gray II ([EMAIL PROTECTED]) wrote: On Jan 14, 2004, at 7:22 PM, Jose Malacara wrote: Since you've already been shown the super easy way, I'll dare to be a little different: #!/us

Re: multiline matching

2004-01-14 Thread James Edward Gray II
On Jan 14, 2004, at 7:22 PM, Jose Malacara wrote: Can someone explain to me how to do multiline matching? I am trying to extract three consecutive lines from a datafile containing multiple records like this: Name: Bob City: Austin State: Texas Address: 123 Whatever Age: 46 Name: Jose City: Denv

Re: redirect with cgi.pm

2004-01-14 Thread James Edward Gray II
On Jan 14, 2004, at 11:07 AM, jdavis wrote: Thanks all who replied. From your post i gather that i need to handle my redirect client sideso. #!/usr/bin/perl use CGI qw(:standard); print header; $| = 1; print "hi\n"; sleep 3; # i would actually do a lot of other stuff here print< EOF If

Re: == eq > gt

2004-01-14 Thread James Edward Gray II
On Jan 14, 2004, at 9:34 AM, Paul Kraus wrote: I understand that the eq and gt are for string comparisons but why not just use the mathematical ones of == or >. Because we want Perl to magically convert our variables to whatever we currently mean (number or string) without making us jump through

Re: redirect with cgi.pm

2004-01-14 Thread James Edward Gray II
On Jan 14, 2004, at 3:25 AM, Jan Eden wrote: Hi, like this: #!/usr/bin/perl -w use strict; use CGI; use CGI::Carp qw(fatalsToBrowser); my $q = new CGI; print $q->header # do this - do that, using $q print $q->redirect("/thanks.html"); Unfortunately, this doesn't work. As Randal already said,

Re: Inheritance - was Re: RFC: Package == class == object type

2004-01-13 Thread James Edward Gray II
On Jan 13, 2004, at 3:44 PM, Gary Stainburn wrote: Did that make any sense? Yes. While driving home I think I've discovered my biggest conceptual block. The idea of a Trainset class is as you know new. The idea was originally to have all code relating to track in the Trainset::Track class. Wha

Re: RFC: Package == class == object type

2004-01-13 Thread James Edward Gray II
On Jan 13, 2004, at 12:05 PM, Rob Dixon wrote: use base (Trainset::Trains Trainset::Track Trainset::Signals Trainset::Levers Trainset::Boxes); inside Trainset.pm. Is this the correct way to call in the other classes? No it's not. use Trainset::Trains; use Trainset::Track; use Trainset::Signals;

Re: Inheritance - was Re: RFC: Package == class == object type

2004-01-13 Thread James Edward Gray II
On Jan 13, 2004, at 11:32 AM, Gary Stainburn wrote: I'm starting to confuse myself again now. Yes, you are. I've got it into my head that I'm going to have an instance of Trainset as a holder to contain track, signals etc, so I'll do something line: my $tset=Trainset->new; $tset->add_track('T

Re: RFC: Package == class == object type

2004-01-13 Thread James Edward Gray II
On Jan 13, 2004, at 10:39 AM, Gary Stainburn wrote: On Tuesday 13 Jan 2004 3:04 pm, James Edward Gray II wrote: On Jan 13, 2004, at 6:24 AM, Gary Stainburn wrote: 3) As everything else will be created from the Trainset instance, they will have a link to it. This will be stored as $self->{_OW

Re: RFC: Package == class == object type

2004-01-13 Thread James Edward Gray II
On Jan 13, 2004, at 6:24 AM, Gary Stainburn wrote: [snip background] 3) As everything else will be created from the Trainset instance, they will have a link to it. This will be stored as $self->{_OWNER}. This will then (hopefully) provide quick direct access to the Trainset variables (were Cla

Re: Problems with Text::Iconv

2004-01-13 Thread James Edward Gray II
On Jan 13, 2004, at 8:10 AM, Jan Eden wrote: Hi, I just managed two install my first two modules, among them Text::Iconv. Now while the iconv utility works fine on my system, the module complains: dyld: perl Undefined symbols: /Library/Perl/5.8.1/darwin-thread-multi-2level/auto/Text/Iconv/

Re: RFC: Package == class == object type

2004-01-12 Thread James Edward Gray II
On Jan 12, 2004, at 2:42 PM, Rob Dixon wrote: Hi Gary. I'm quite concerned about this thread. I think we could help you a lot more if we had a better grasp of the problem: instead we've been answering individual questions that you've raised, hoping that they help you to achieve your goal but with

Re: RFC: Package == class == object type

2004-01-12 Thread James Edward Gray II
On Jan 12, 2004, at 11:44 AM, Gary Stainburn wrote: This is a very good point, and I am currently looking at changing my code to better modularise and to have a Trainset object. My two stumbling blocks are still: 1) How could a sub-class access the Trainset globals without knowing the instanc

Re: RFC: Package == class == object type

2004-01-12 Thread James Edward Gray II
On Jan 12, 2004, at 10:21 AM, Gary Stainburn wrote: I'm trying to model a very simple neural net, where the changes in one block affect all of it's neighbours. e.g. If one block becomes occupied the signal to enter it should change to red. The signal of the block in rear should change to cauti

Re: RFC: Package == class == object type

2004-01-12 Thread James Edward Gray II
On Jan 12, 2004, at 5:27 AM, Gary Stainburn wrote: Hi folks, Hello again. I'm after peoples opinions on my (beginner's) slant objects in perl. I'll see what I can do. In much of what I've read, there seems to be the implied rule that Package Name == Class == Object Type, specifically MyObject

Re: Leading zeroes

2004-01-10 Thread James Edward Gray II
On Jan 10, 2004, at 8:34 AM, Olivier Wirz wrote: Hello, How can I suppress the leading zeroes, except one when all positions are 0; for example: 15 will be 15 00 will be 0 See if this one-liner gets you going: perl -le 'foreach (@ARGV) { s/^0+([0-9])/$1/; print; }' 15 00 15 0 J

Re: Use of FOR statement

2004-01-09 Thread James Edward Gray II
On Jan 9, 2004, at 7:15 AM, Paul Kraus wrote: Use english? perldoc English TMTOWTDI? Pronounced "Tim Toady", There's More Than One Way To Do It. The Perl motto. James -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: PERL debuggers

2004-01-07 Thread James Edward Gray II
On Jan 7, 2004, at 2:35 PM, <[EMAIL PROTECTED]> wrote: Beside perldebug, ... Why? This is a very capable debugger. Why would it be a choice to avoid? James -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: 'print' output on one line

2004-01-06 Thread James Edward Gray II
On Jan 6, 2004, at 2:53 PM, Esposito, Anthony wrote: Is there a 'print' option/escape character the sends the file pointer ( for STDOUT in this case ) back to the beginning of the line? Sure is. Try ending your lines with a "\r" instead of a "\n". Works on Unix at least. James -- To unsubscri

Re: Sharing instances of objects between packages

2004-01-05 Thread James Edward Gray II
On Jan 5, 2004, at 6:30 PM, drieux wrote: On Jan 5, 2004, at 2:51 PM, James Edward Gray II wrote: sub new { my $class = shift; my $self = $class->SUPER::new( @_ }; # call class A constructor --^ oopsie should have been a ")" Good

Re: Sharing instances of objects between packages

2004-01-05 Thread James Edward Gray II
On Jan 5, 2004, at 2:44 PM, Shawn McKinley wrote: Hello all, I am wondering if you can have object inherited between packages when the child packages have their own object creation without explicitly setting the parent object in the child? Is there a way to inherit the parent object? Example be

<    1   2   3   4   5   6   7   8   >