Reading elements into hash

2004-02-28 Thread Leaw, Chern Jian
Hi, I have a script written below (by John Krahn and WC-Sx-Jones from this mailing list) which changes the file format from: #cat PSCS-ORIG abinabdu adanie2 agibson agoh1aiabouse akko alau alee1alee2amitb amohdali amshams anmohand to the format listed below when pr

Tool Like TOAD

2004-02-28 Thread KENNETH JANUSZ
Is there a tool like TOAD that I can use with PERL on Windows XP Prof.? Thanks much, Ken Janusz, CPIM

Re: Module to pull Netstat summary information?

2004-02-28 Thread WC -Sx- Jones
R. Joseph Newton wrote: In Perl, every method has aan implicit argument list, which may be empty. DoinK! :) So, since it is implied - you don't need it. My orginal code fragment was &print_if_Fatal if (system("netstat -nr") / 256); Your version print_if_Fatal() if (system("netstat -nr") / 25

Re: subroutine definitions

2004-02-28 Thread Andrew Gaffney
R. Joseph Newton wrote: Andrew Gaffney wrote: R. Joseph Newton wrote: I am writing a module that contains functions that I commonly use in my scripts. I have written a lot of scripts that generate HTML reports from the data in the MySQL DB. My boss wants these reports to spit out their data eith

Re: Changing file output format

2004-02-28 Thread R. Joseph Newton
"John W. Krahn" wrote: > "R. Joseph Newton" wrote: > > > > "Leaw, Chern Jian" wrote: > > > > > > $currDir = `pwd`; > > > chomp($currDir); > > > > Don't use chomp here. The chomp function is for situations where > > you may not know whether a line is terminated by a newline. You > > just assigned

Re: CODING STYLE (are you a Perl Peep?)

2004-02-28 Thread R. Joseph Newton
WC -Sx- Jones wrote: > ''=~('('.'?'.'{' >. ('`'|'%').('['^"\-").( ( ... >('.')^'~';$~='@'|'(';$^=')'^'[';$/=( > ( '`'))|'.';$,='('^'}';$\='`'|'!'; ( > ( $:))=')'^'}';$~='*'|'`';$^='+'

Re: subroutine definitions

2004-02-28 Thread Andrew Gaffney
James Edward Gray II wrote: On Feb 28, 2004, at 7:05 PM, Andrew Gaffney wrote: I'm getting conflicting advice between your post and another post to this thread. Maybe if I post my code, you can recommend the best way for me to setup my functions and the calls to them (and whether to prototype t

Re: Module to pull Netstat summary information?

2004-02-28 Thread R. Joseph Newton
WC -Sx- Jones wrote: > R. Joseph Newton wrote: > > &print_if_Warn if (system("nstat -a") / 256); > > &print_if_Fatal if (system("netstat -nr") / 256); > > > > > > Works fine as: > > print_if_Warn() if (system("nstat -a") / 256); > > print_if_Fatal() if (system("netstat -nr") / 256); >

Re: subroutine definitions

2004-02-28 Thread R. Joseph Newton
Andrew Gaffney wrote: > R. Joseph Newton wrote: > > I am writing a module that contains functions that I commonly use in my scripts. I > have > written a lot of scripts that generate HTML reports from the data in the MySQL DB. > My boss > wants these reports to spit out their data either in HTM

Programming a skinnable GUI in perl

2004-02-28 Thread Christian WattengÄrd
What should I use to program a skinnable GUI in perl? The application is a mp3 jukebox and there are some criterias to be met: * It must be usable by touchscreen only * It must be completely skinnable * It must be able to run fullscreen without window decorations as the sole program on a X server

Re: Array question

2004-02-28 Thread R. Joseph Newton
"R. Joseph Newton" wrote: > Chris wrote: > > > my %found = (); > > foreach (@emails) { $found{$_}++ }; > > foreach (@exclude) { exists $found{$_} and delete $found{$_} } > > Too complicated. Check Wolf's suggestion: Ooops, excuse the brain fart: > > $unwanted{$_} = 1 foreach @exclude; > my @tem

Re: subroutine definitions

2004-02-28 Thread James Edward Gray II
On Feb 28, 2004, at 7:05 PM, Andrew Gaffney wrote: I'm getting conflicting advice between your post and another post to this thread. Maybe if I post my code, you can recommend the best way for me to setup my functions and the calls to them (and whether to prototype them). This code will be for

Re: CODING STYLE (are you a Perl Peep?)

2004-02-28 Thread WC -Sx- Jones
David le Blanc wrote: What for you EyeDrop your Email? Just to irritate "the other." ;-) discombobulated why Thx! :) BTW - Not that I am ignoring anyone but once I finish my latest WebSphere nightmare I will work on an FTP version of find2perl -- I dont want the Internet to be lost and

Re: subroutine definitions

2004-02-28 Thread Andrew Gaffney
R. Joseph Newton wrote: Andrew Gaffney wrote: I'm not exactly a beginner. I've been using Perl for about 8 months. It's just that I've never written a subroutine where I need to pass array or hash *references*. Regardless of how long you have been writing in Perl, if you have not yet: Star

RE: CODING STYLE (are you a Perl Peep?)

2004-02-28 Thread David le Blanc
What for you EyeDrop your Email? --> --> R. Joseph Newton wrote: --> > Geez, and I still can't tell whether I'm a "Perl person". I use Perl as a medium --> > for programming, which I do in English. I see POD as documentation for the users of --> > modules. That is a rather different funct

Re: listing prime numbers in a range (Beginning Perl exercise)

2004-02-28 Thread R. Joseph Newton
Stuart White wrote: > So I figured out from folks on the list, Beginning > Perl, and some print statements that > @list = (2 .. $input); > > puts the range of numbers into an array, and that if I > stringified it, then it would put the entire range > into $list[0] > > Now that I've figured that bi

Re: subroutine definitions

2004-02-28 Thread John W. Krahn
Andrew Gaffney wrote: > > Charles K. Clarkson wrote: > > Andrew Gaffney <[EMAIL PROTECTED]> wrote: > > : > > : I'm trying to write a subroutine that takes two scalars and two > > : arrays as parameters. I've read that if you try to do this in a > > : function, both arrays will get combined within

Re: DBI Problem

2004-02-28 Thread R. Joseph Newton
[EMAIL PROTECTED] wrote: > Well I have a table if information with 3 columns being populated by perl > variables drawn from an SQL database. The leftmost table will always get > populated. the two right colums have a link in them. the anhcor tags > always show up, but not the text for the link.

Re: Automatically write in uppercase

2004-02-28 Thread R. Joseph Newton
John wrote: > How can activate the caps lock while the user write in a perl programt (Perl/Tk) Why would you want to do that?!? Joseph -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: subroutine definitions

2004-02-28 Thread R. Joseph Newton
Andrew Gaffney wrote: > > I'm not exactly a beginner. I've been using Perl for about 8 months. It's just that > I've > never written a subroutine where I need to pass array or hash *references*. Regardless of how long you have been writing in Perl, if you have not yet: Started using strict a

Re: Changing file output format

2004-02-28 Thread WC -Sx- Jones
John W. Krahn wrote: The output from running a command in backticks will have newlines although in scalar context it could have more then just one at the end. $ perl -le'$x = `pwd`; print $x =~ tr/\n//; $x = `ls -l`; print $x =~ tr/\n//;' 1 236 In other words 1 line ending for 'print working dir

Re: Changing file output format

2004-02-28 Thread John W. Krahn
"R. Joseph Newton" wrote: > > "Leaw, Chern Jian" wrote: > > > > $currDir = `pwd`; > > chomp($currDir); > > Don't use chomp here. The chomp function is for situations where > you may not know whether a line is terminated by a newline. You > just assigned a value to pwd, so it is pointless to the

Re: Module to pull Netstat summary information?

2004-02-28 Thread WC -Sx- Jones
R. Joseph Newton wrote: &print_if_Warn if (system("nstat -a") / 256); &print_if_Fatal if (system("netstat -nr") / 256); Works fine as: print_if_Warn() if (system("nstat -a") / 256); print_if_Fatal() if (system("netstat -nr") / 256); Yes, so long as you dont use perl -w progname Otherwise yo

Re: Module to pull Netstat summary information?

2004-02-28 Thread WC -Sx- Jones
R. Joseph Newton wrote: So what is the pressing need to eliminate parrentheses? For not only C programmers, but for people familiar with a whole range of C-based languages, parentheses make very clear the context in which an identifier is being used. I can apprediate that there are contexts in w

Re: Changing file output format

2004-02-28 Thread R. Joseph Newton
"Leaw, Chern Jian" wrote: > HI, > I would like to change output format of a file from: > ... > to the format listed below when printing it out to the standard output: > > abinabdu > ... > Each elements in the file are sepated by 1 or more spaces (see attached file). > > The script written below a

Re: CODING STYLE (are you a Perl Peep?)

2004-02-28 Thread WC -Sx- Jones
''=~('('.'?'.'{' . ('`'|'%').('['^"\-").( ( ('`'))|'!').('`'|',')."\"".( ( '#')).'!'.('{'^'[').'/'.("\["^ ( ( '.'))).('['^'(').('['^')').'/'.( ( ('`'))|'"').('`'|')').('`'|'

Re: Perl Newbie

2004-02-28 Thread WC -Sx- Jones
James Edward Gray II wrote: At the top of my To Learn When I Have Time list is POE. I'll definitely get to that before I find myself writing another server. I think that's a much better choice than working out the low-level networking mess by hand. Yes, there ya go. POE is the only future

Re: Module to pull Netstat summary information?

2004-02-28 Thread R. Joseph Newton
WC -Sx- Jones wrote: > # just predeclare them ALL here; before they are used. > # See my comments below What I see here are not declarations, but calls. They need no extra decoration, unless you have a passion for dispensing with parentheses. I like parentheses, for my art. I think they can h

Re: CODING STYLE (was Re: Count the number of lines in a file without actually iterating through the file)

2004-02-28 Thread R. Joseph Newton
WC -Sx- Jones wrote: > R. Joseph Newton wrote: > > Bryan Harris wrote: > > > > > perl -lpe '}{*_=*.}{' file > >>> > >>>Ooh, an obfuscated verbose way of writing: > >>> > >>>perl -lpe'}{$_=$.' file > >> > >>Huh? Could someone explain this? The "}{" makes no sense to me... > > > > > > Well, as

Re: Trainset - initial release

2004-02-28 Thread R. Joseph Newton
"John W. Krahn" wrote: > If you want a lexically scoped sub you > have to assign a sub reference to a lexically scoped scalar like: > > my $sub_name = sub { do something }; > > John Thanks, John, That cleared up a point for me. joseph -- To unsubscribe, e-mail: [EMAIL PROTECTED] For ad

Re: subroutine call weirdness

2004-02-28 Thread R. Joseph Newton
"Michael C. Davis" wrote: > At 08:54 PM 2/27/04 -0800, R. Joseph Newton wrote: > >I think it might also be good to refer the OP back to James' post, which > he seems > >to have overlooked. The caveat you provided earlier still makes sense. > > Thanks for the ideas. Are you referring to James' su

Re: how to remove an element in an array

2004-02-28 Thread R. Joseph Newton
"R. Joseph Newton" wrote: > David Inglis wrote: > > > Is there a command to drop an element from an array, or what is the best > > way to do this. > > > > Any help appreciated. > > > > -- > > Regards > > > > David Inglis > > If at all possible, design around the need. Sorry if the above was too c

Automatically write in uppercase

2004-02-28 Thread John
How can activate the caps lock while the user write in a perl programt (Perl/Tk)

Re: Array question

2004-02-28 Thread R. Joseph Newton
Chris wrote: > my %found = (); > foreach (@emails) { $found{$_}++ }; > foreach (@exclude) { exists $found{$_} and delete $found{$_} } Too complicated. Check Wolf's suggestion: $unwanted{$_} = 1 foreach @exclude; my @temp; push @temp while (my $email = shift @emails) { push @temp, $email unles

RE: DBI Problem

2004-02-28 Thread Jeremy Bush
I have awnsered the questions last night in an updated post. If I didn't say so in that post, the problem is not browser specific. Jeremy > -Original Message- > From: R. Joseph Newton [mailto:[EMAIL PROTECTED] > Sent: Saturday, February 28, 2004 1:53 PM > To: Jeremy Bush > Cc: [EMAIL P

Re: DBI Problem

2004-02-28 Thread R. Joseph Newton
Jeremy Bush wrote: > Hi, im using DBI to connect to a SQL database in order to serve dynamic > content. Some people have reported to me that some fields are blank on > my dynamic pages. It is as if the variable that is supposed to hold the > data is being returned with no information it it. I h

Re: Perl Newbie

2004-02-28 Thread James Edward Gray II
On Feb 28, 2004, at 1:24 PM, R. Joseph Newton wrote: Rob Dixon wrote: David Le Blanc wrote: Actually, I'd better apologise for calling RPC::p* secure, simple, or well documented, before anyone comes at me with a knife :-( You won't feel a thing. Trust me: I'm an analyst. /R Well, this has all be

Re: Reading File & grep according item 5 and sorting

2004-02-28 Thread R. Joseph Newton
Bjorn Van Blanckenberg wrote: > let say that the file contains these items (every item is seperated > with a tab) > ... > > one title3 state3 name3 pre number3 > dip title6 state6 name6 pre2 number6 > So what changes have you made in the code to reflect this diffeence in speci

Re: Perl Newbie

2004-02-28 Thread R. Joseph Newton
Rob Dixon wrote: > David Le Blanc wrote: > > > > Actually, I'd better apologise for calling RPC::p* > > secure, simple, or well documented, before anyone comes > > at me with a knife :-( > > You won't feel a thing. Trust me: I'm an analyst. > > /R Well, this has all been fun [and funny] reading.

Reg. Net::Pcap open_live method

2004-02-28 Thread Balaji Thoguluva
Hi, I would like to know if Net::PCap::open_live() method can take 'any' as value for $dev argument. My intention is to catch packets that come on all network interfaces of a computer (especially on eth0 and lo, loopback interface). The prototype of open_live is Net::Pcap::open_live($dev,

Re: listing prime numbers in a range (Beginning Perl exercise)

2004-02-28 Thread James Edward Gray II
On Feb 28, 2004, at 11:12 AM, Stuart White wrote: So I figured out from folks on the list, Beginning Perl, and some print statements that @list = (2 .. $input); Good work. puts the range of numbers into an array, and that if I stringified it, then it would put the entire range into $list[0] That'

Re: listing prime numbers in a range (Beginning Perl exercise)

2004-02-28 Thread Stuart White
So I figured out from folks on the list, Beginning Perl, and some print statements that @list = (2 .. $input); puts the range of numbers into an array, and that if I stringified it, then it would put the entire range into $list[0] Now that I've figured that bit out, I went on to remove all the e

Re: listing prime numbers in a range (Beginning Perl exercise)

2004-02-28 Thread Stuart White
So I figured out from folks on the list, Beginning Perl, and some print statements that @list = (2 .. $input); puts the range of numbers into an array, and that if I stringified it, then it would put the entire range into $list[0] Now that I've figured that bit out, I went on to remove all the e

Re: Trainset - initial release

2004-02-28 Thread James Edward Gray II
On Feb 27, 2004, at 10:16 PM, David le Blanc wrote: [ I couldn't find nested sub's in the source. ? ] From Trainset.pm: sub throw_lever {# return a lever object sub barf { print "$_[1]\n" if ($_[0]); } print "throw_lever..." if (&debug); my $self=shift; ... Subs do nest. Jus

Re: subroutine definitions

2004-02-28 Thread WilliamGunther
In a message dated 2/28/2004 3:28:55 AM Eastern Standard Time, [EMAIL PROTECTED] writes: > - Stop using prototypes. You'll find it easier to write perl > programs without them. Prototypes are useful and sometimes necessary, as in the supplied problem. What would be called my_subroutine($sc

Re: Fun module of the Month

2004-02-28 Thread WC -Sx- Jones
Andrew Gaffney wrote: WC -Sx- Jones wrote: Acme::Eyedrops (with apologies to Andrew J. Savige) Will this work on mod_perl scripts, also? I see no reason why it wouldn't, but it doesn't hurt to ask. mod_perl may be too complex for it. you can try it. Ill see if it croaks on what i have. -B

Re: subroutine definitions

2004-02-28 Thread Andrew Gaffney
Charles K. Clarkson wrote: Andrew Gaffney <[EMAIL PROTECTED]> wrote: : : I'm trying to write a subroutine that takes two scalars and two : arrays as parameters. I've read that if you try to do this in a : function, both arrays will get combined within '@_'. Andrew, - Stop using prototypes. You'l

Re: Fun module of the Month

2004-02-28 Thread Andrew Gaffney
WC -Sx- Jones wrote: Acme::Eyedrops (with apologies to Andrew J. Savige) Will this work on mod_perl scripts, also? I see no reason why it wouldn't, but it doesn't hurt to ask. -- Andrew Gaffney Network Administrator Skyline Aeronautics, LLC. 636-357-1548 -- To unsubscribe, e-mail: [EMAIL PROTECTE

Re: Fun module of the Month

2004-02-28 Thread WC -Sx- Jones
David le Blanc wrote: install Acme::EyeDrops ^ All my source is now camel and coffee shaped...damn you. ;-) d'Oh! And you know, I see that various invocations of CPAN's use of ftp can find the files with / instead of :: Why cant 'install Acme/EyeDrops' work as if I typed 'in

RE: Fun module of the Month

2004-02-28 Thread David le Blanc
> From: WC -Sx- Jones > [mailto:[EMAIL PROTECTED] > Sent: Saturday, 28 February 2004 9:48 PM > To: '[EMAIL PROTECTED]' > Subject: Fun module of the Month > > Acme::Eyedrops > (with apologies to Andrew J. Savige) > > > However, I find it strange that > > perl -MCPAN -e shell > install Acme::Ey

Fun module of the Month

2004-02-28 Thread WC -Sx- Jones
Acme::Eyedrops (with apologies to Andrew J. Savige) However, I find it strange that perl -MCPAN -e shell install Acme::Eyedrops Says it cannot find Acme::Eyedrops... -Bill- __Sx__ http://youve-reached-the.endoftheinternet.org/ ''=~('('.'?'.'{

Re: cool project ideas

2004-02-28 Thread R. Joseph Newton
Wiggins d Anconia wrote: > GIF compression or GIF images? AFAIK, that is a false distinction. Unless some standard release since 89A has changed this, LZW compression is integral to the GIF format. Unlike JPEG / JFIF, which includes parameters for the dgree of compression/lossiness, GIF compres

Re: Changing file output format

2004-02-28 Thread WC -Sx- Jones
WC -Sx- Jones wrote: And ... if you change this line: next unless $word =~ /\w/; To - next unless $word =~ /^\w{5}$/; It will only find 5 letter words... Truly sorry now - I'll go back into hibernation. -Bill- __Sx__ http://youve-reached-the.

RE: Changing file output format

2004-02-28 Thread Leaw, Chern Jian
Hi John, Yes I intended to put all into a single array, but failed to do so earlier. When I execute the script I expect the output to look like: abinabdu adanie2 agibson agoh1 aiabouse akko alau alee1 alee2 amitb amohdali amshams anmohand Thanks -Original Message- From: John W. Krahn [

Re: Changing file output format

2004-02-28 Thread WC -Sx- Jones
WC -Sx- Jones wrote: Grrr, I forgot about MANY files: my @files = @ARGV ? @ARGV : die "I need at least one filename argument\n\n"; foreach my $filetarget (@files) { open (FHANDLE, "<$filetarget") or die "owie, cannot open $filetarget"; my %count; while () { for my $word (split) {

Re: Changing file output format

2004-02-28 Thread John W. Krahn
Chern Jian Leaw wrote: > > HI, Hello, > I would like to change output format of a file from: > abinabdu adanie2 agibson agoh1aiabouse > akko alau alee1alee2amitb > amohdali amshams anmohand > > to the format listed below when printing it out to the standard output: > > a

Re: Trainset - initial release

2004-02-28 Thread John W. Krahn
Gary Stainburn wrote: > > Hi folks, Hello, > as many of you who follow this list will know, a while back I decided to learn > OOP and set myself the task of simulating a railway system. > > A number of people asked if I could make the code available for viewing in > order to help me with my que

Re: Changing file output format

2004-02-28 Thread WC -Sx- Jones
=pod Leaw, Chern Jian wrote: to the format listed below when printing it out to the standard output: abinabdu adanie2 agibson agoh1 aiabouse akko alau alee1 alee2 amitb amohdali amshams anmohand my %count; while () { for my $word (split) { next unles

Changing file output format

2004-02-28 Thread Leaw, Chern Jian
HI, I would like to change output format of a file from: abinabdu adanie2 agibson agoh1aiabouse akko alau alee1alee2amitb amohdali amshams anmohand to the format listed below when printing it out to the standard output: abinabdu adanie2 agibson agoh1 aiabouse

Re: Trainset - initial release

2004-02-28 Thread John W. Krahn
David Le Blanc wrote: > > -- SAMPLE --- > sub jack > { > my $v; > > sub jill > { > my $j = shift; > print "jill: v = $v".$/; > print "jill: j = $j".$/; > print "jill:total = ".($v+$

RE: subroutine definitions

2004-02-28 Thread Charles K. Clarkson
Andrew Gaffney <[EMAIL PROTECTED]> wrote: : : I'm trying to write a subroutine that takes two scalars and two : arrays as parameters. I've read that if you try to do this in a : function, both arrays will get combined within '@_'. Andrew, - Stop using prototypes. You'll find it easier to write

Re: CODING STYLE (was Re: Count the number of lines in a file without actually iterating through the file)

2004-02-28 Thread WC -Sx- Jones
John W. Krahn wrote: Wc -Sx- Jones wrote: Most employers (and a quiet a few IT managers) are not very Perl savvy and would like you Perl people (read POD) to be more like COBOL people (read BOOKS.) Don't you mean "we Perl people" or are you inferring that you are not "a Perl person?" I apologize