Re: directory listing to array

2001-06-07 Thread Paul
--- Evan McNabb <[EMAIL PROTECTED]> wrote: > I've been working on a little script for a while but I can't seem to > get this part working. What I want to do is list all of the *.jpg > files in a directory (ls *.jpg) and then have an array with each > filename as elements of that array. Its probab

Re: regexp question

2001-06-07 Thread Paul
--- Martin Weinless <[EMAIL PROTECTED]> wrote: > take the regexp '.n+..?.?v*.' > > By all that is sacred, if we use the string 'supernova', there should > be no match since there are too many characters before the 'n' Not true. . matches the r in supernova n+ matches one or more n's, so it

Re: Variable scope behavior in foreach loop

2001-06-07 Thread Paul
--- "Robin Lavallee (LMC)" <[EMAIL PROTECTED]> wrote: > > Hi, > > I have a small conceptual problem. I have been > told that doing: > > my $item; > foreach $item (@arr) { ... } > > is more efficient than: > foreach my $item (@arr) { ... } > > Because it does not reallocate memory each

Re: Variable scope behavior in foreach loop

2001-06-07 Thread Paul
--- "Robin Lavallee (LMC)" <[EMAIL PROTECTED]> wrote: > Then can someone explains why the following code: > > #---Begin Code--- > use strict; > my $par="50"; > print "$par\n"; > > my @arr = ('first', 'second', 'third'); > foreach $par (@arr) > { > print "$par\n"; > } > print "$par\n"; > #

Re: More "Succinctification"

2001-06-07 Thread Paul
--- Teresa Raymond <[EMAIL PROTECTED]> wrote: > How can we make this code more succinct? A quick run through perltidy adds some whitespace: #LOOP TO INITIALIZE VARIABLES + TEST N COMMANDS FOR MATCH IS YES foreach $i( sort(@indata) ) { chop

Re: Using C code with perl

2001-05-31 Thread Paul
ot;cookbook" file that provides wonderful examples that can be modified and applied, practically from day 1. Just read them carefully to make sure you don't open a memory leak (or hole in the dam, for that matter. =o) Brian, while I'm on that topic -- is there a book planned for Inline an

Re: delay array element

2001-06-08 Thread Paul
--- [EMAIL PROTECTED] wrote: > i've read over push/pop/shift/unshift. is there another function > which allows you to delete an array element without leaving it as an > empty element? c.f. perldoc -f splice =o) = print "Just another Perl Hacker\n"; # edited for readability =o) =

Re: Gurus Wanted!!

2001-06-08 Thread Paul
--- scott lutz <[EMAIL PROTECTED]> wrote: > I have a this fancy bit of recursive search and replace code that I > picked > up somewhere, but I would greatly appreciate it if one of the gurus > could > explain it in English for me: > > find . -type f -print0 | xargs -0 perl -pi -e 's/< here>>/<

Re: File Handles as arguments...

2001-06-11 Thread Paul
--- Mike Breeze <[EMAIL PROTECTED]> wrote: > -- Original Message -- > From: "Evgeny Goldin (aka Genie)" <[EMAIL PROTECTED]> > > > >> CODE 3: > >> printit(*Some_Handle); > > > >> CODE 4: > >> printit(\*Some_Handle); > > > > > >If you're choosing betw

Re: Arrays of Hashes - Still stumped :(

2001-06-11 Thread Paul
--- Bryan Gmyrek <[EMAIL PROTECTED]> wrote: > I've written a program where I need to use an array of hashes. The > basic code I am having problems with is: > > sub read_from_file{ > #input: file name that holds lines of info in the form key: value > #action: add these to an array of hashes > #

Re: Passing FileHandle as Arguments Always Better?

2001-06-11 Thread Paul
--- Charles Lu <[EMAIL PROTECTED]> wrote: > If you want to write a subroutine that write the output to a text > file you can do this: > > open FILE ">temp.txt" or die; > &function_one (\*FILE); > > sub function_one{ > my $fh = shift; > print $fh "blah blah blah\n"; > } > > OR you can d

Re: Get character from a string

2001-06-11 Thread Paul
--- DeXteR <[EMAIL PROTECTED]> wrote: > Like we have string $blah = "abcdef" and i wand for example character > 5, the "e", to mess around with further. How should i do that? I'd probably say substr($blah,4,1) ( though you could do something wierd like (split '', $blah)[4] if you want

Re: Getting Perl to interact with passwd

2001-06-11 Thread Paul
--- Daniel Ames <[EMAIL PROTECTED]> wrote: > Hi all, > > This was brought up before, but the archives didn't really answer my > question. > > I'm trying to get my script to reset a password for me via the passwd > command. Keep in mind, I'm very new, so if this is dumb, try not to > laugh: > >

Re: Pushing more than 1 item onto a list

2001-06-12 Thread Paul
--- Charles Lu <[EMAIL PROTECTED]> 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() =o) @x = (); push @x, qw / a b c d e /; print "@x \n"; p

Re: use of split command

2001-06-12 Thread Paul
--- Stephen Henderson <[EMAIL PROTECTED]> wrote: > I am trying to read a quite large file (ca 13000 lines) directly into > an array (for speed) > like this > > open (ACCS, "C:\\Perl\\BioPerl-0.7\\Seqdata\\Accession.txt") or die > "can't open Accessions file"; > @ets=; > $ets_count=@ets; > > the

Re: making a variable name a variable value?

2001-06-12 Thread Paul
--- Chirag Patel <[EMAIL PROTECTED]> wrote: > I was wondering how to make a variable name the value of another > variable. > for example: $name = "jerry"; > how can I establish a variable with the name > $jerry ? Several ways. c.f. the other responses, but you could also use an eval: eval "

Re: Getting to the contents of a class..

2001-06-12 Thread Paul
--- Michael Fowler <[EMAIL PROTECTED]> wrote: > On Tue, Jun 12, 2001 at 09:31:08AM +0200, Ela Jarecka wrote: > > In my code, I finally wrote: > > > > foreach my $item ( keys %$reqrec ) { > > ... > > } > > If that's how you want to design your class to be used it's up to > you, but keep in mind

Re: simple Perl question

2001-06-12 Thread Paul
--- [EMAIL PROTECTED] wrote: > I have a very simple question.. i want to know how can I tell my > program to go back to the beginning of the program depending on the > user input? > > Candice Not homework, is it? If so, you should really say that before posting the question. Even so, here's a h

Re: checking the status of FileHandle

2001-06-13 Thread Paul
--- Charles Lu <[EMAIL PROTECTED]> wrote: > >Lets say I want my program to print to STDOUT unless the user > specifies that the output goes to a file. Here is my code: > > > > my $oldhandle=undef; > if($user_input ne 'STDOUT') { #user specify output to a > file > open (OUT,

Re: Strict, require and hashes..

2001-06-13 Thread Paul
--- Dianne Van Dulken <[EMAIL PROTECTED]> wrote: > Hi all, > > I was (yet again) hoping someone might help me with something. > > I have a cfg file called extra_details.cfg containing a hash > %my_hash. > > I reference this in my perl script, using a require > "extra_details.cfg" > > The

Re: combine STDERR and STDOUT

2001-06-13 Thread Paul
--- Charles Lu <[EMAIL PROTECTED]> wrote: > How do I direct the messages destined for STDERR and redirect them to > STDOUT? try: *STDERR = *STDOUT; This aliases STDERR so that it's really STDOUT anyway. = print "Just another Perl Hacker\n"; # edited for readability =o)

Re: map question

2001-06-14 Thread Paul
--- [EMAIL PROTECTED] wrote: > context". How do you evaluate a block in scalar context? Any light on > this ( or a pointer ) maybe? print { *STDOUT } "foo\n"; This is looking at the block to return the filehandle to which the output should go. Surely that argument is in a scalar context, sep

Re: Huge hash ... running out of memory without warning???

2001-06-14 Thread Paul
--- "Brett W. McCoy" <[EMAIL PROTECTED]> wrote: > On Wed, 13 Jun 2001, Bryan Gmyrek wrote: > > > I have just written a program that makes an array of hashes of > hashes of > > hashes. It reads all kind of information in from a bunch of files > and > > then later I access the elements of this th

Re: mystery

2001-06-14 Thread Paul
--- Sally <[EMAIL PROTECTED]> wrote: > I got the following code from a tutorial. Are you sure you got all of it? I see a lot of bare HTML, which should send the Perl parser into predictable spasms even *without* strict (but use strict!!!). > When I uploaded (FTP) it as a perl > file I got more

Re: regex matching

2001-06-14 Thread Paul
--- [EMAIL PROTECTED] wrote: > i have a basic knowledge of regex but i want to know if there is a > simpler way to pull patterns out of a line. > > if i have a line like: > > here is a sample with 123.456.123.456 in the middle. > > m/\d\.\d\.\d\.\d/ will match the entire line. is there a

Re: Slicing and dicing

2001-06-14 Thread Paul
--- David Gilden <[EMAIL PROTECTED]> wrote: > Is one style better then the other here? > > sub print_table_rows { > my $name = shift; > my $key = shift; > my $date = shift; > --- alt > sub print_table_rows { > my ($name,$key,$date) = @_[0..2] I'd just say my ($name,$key,$date) = @_;

re: hashes

2001-06-15 Thread Paul
--- Oliver Glass <[EMAIL PROTECTED]> wrote: > Paul, thanks so much for all this information! You're welcome. I'm glad somebody appreciated it. =o) > As well as helping me learn your kindness really brightened up a > dreary day at the office :) lol -- worth the time,

Re: Reading versus Referencing Books

2001-06-15 Thread Paul
--- Scott Thompson <[EMAIL PROTECTED]> wrote: > I'm curious. How many of you out there (newbies and oldies alike) > would suggest reading a book ("Programming Perl," for example...) > cover to cover to learn a language? It depends on the book and the person. I learn best by pouring the docs in

Re: sort by number...

2001-06-15 Thread Paul
--- David Gilden <[EMAIL PROTECTED]> wrote: > Good day, > > keys look like: Dowda_23241506142001 > > This is wrong, but not sure how the syntax is, > > Where are $a,$b coming from, I thought of a sub, but how do assign > $a, $b $a and $b are automagically assigned values. LEAVE THEM ALONE! =o

RE: Can't understand Reference interpretation

2001-06-15 Thread Paul
--- Peter Scott <[EMAIL PROTECTED]> wrote: > At 09:35 AM 6/15/01 -0400, you wrote: > >So why would you call a reference to an array instead of just > calling the > >array itself? > > Assuming your question doesn't contain some implication to the thread > but it just a general question of why an

Re: readline

2001-06-15 Thread Paul
--- Bob Mangold <[EMAIL PROTECTED]> wrote: > I'm having trouble reading STDIN. > > This works: > > $a = readline STDIN; > print $a; # prints out whatever was inputed > > But the does not work: > > use strict; > $a = readline ; # forced to use > print $a; # prints nothing This reads a line f

RE: Re[4]: When to use "my"?

2001-06-16 Thread Paul
--- Peter Cornelius <[EMAIL PROTECTED]> wrote: > >It's also worth mentioning that if you 'use strict;' you can't > declare > >you're own symbol table variables so all of your user defined > variables > will > >be lexically scoped. > > I need to correct myself. I said you can't declare symbol ta

Re: [OT] thread CLOSED

2001-06-16 Thread Paul
--- Kevin Meltzer <[EMAIL PROTECTED]> wrote: > . . . > In general, if your post begins with: > > "I know this isn't the right list for this" > > or > > "I know this is off topic, but..." > > You probably shouldn't send it. When in doubt, ask one of the keepers > of the clue-bats, before p

Re: fork .. regex ... etc..

2001-06-18 Thread Paul
--- "Ronald J. Yacketta" <[EMAIL PROTECTED]> wrote: > Paul, > anyword on that skeleton code you mentioned ??? This is actually a process-to-CPU "spooler" I wrote a while back for load-balancing on our production data processing machine. It's worked reasona

Re: Please suggest a better method...

2001-06-18 Thread Paul
--- Me <[EMAIL PROTECTED]> wrote: > > tr{abcdefghijklmnoprstuvwxy} > > {222333444555666777888999}; > > or, for a smidgen extra legibility: > > > tr{abc def ghi jkl mno prs tuv wxy} > > {222 333 444 555 666 777 888 999}; > > Wrap that with -p, and you can make the whole pr

Re: class definition

2001-06-18 Thread Paul
--- Nick Transier <[EMAIL PROTECTED]> wrote: > Here is a basic attribute definition from an O'Reilly Book: > > sub new { > my $invocant = shift; > my $class = ref($invocant) || $invocant; > my $self = { >color => "bay", >legs => 4, >

Re: Private Data

2001-06-18 Thread Paul
--- Nick Transier <[EMAIL PROTECTED]> wrote: > Does the C++ notion of private data have a similar structure in perl, > when defining packages, I find that when I try to define global > variables inside the package, but outside of all the subroutines, I > get a million errors. If you need privat

Re: How to create a log file from a perl script

2001-06-18 Thread Paul
--- David Gilden <[EMAIL PROTECTED]> wrote: > Could you comment briefly on the use of > select LOG; from perldoc -f select: select FILEHANDLE Returns the currently selected filehandle. Sets the current default filehandle for output, if FILEHANDLE is supplied. This has two

Re: $hash{$_}++

2001-06-18 Thread Paul
--- "Brett W. McCoy" <[EMAIL PROTECTED]> wrote: > On Mon, 18 Jun 2001, David Gilden wrote: > > > I am having trouble understanding just what the following does, > > and how to you use it: > > > > $hash{$_}++ > > > > i.e. are we increment the value or the key? > > The value. If you wanted to

Re: Private Data

2001-06-18 Thread Paul
--- Nick Transier <[EMAIL PROTECTED]> wrote: > Thanks, do you start the brackets before the "package blah" call, or > after. > I.E. is it {package blah; #stuff; } or package blah; {#stuff;} ? It depends on how tightly private you want those variables. I always put the package statement inside t

Re: exec()

2001-06-21 Thread Paul
--- "Yacketta, Ronald" <[EMAIL PROTECTED]> wrote: > I am running the following (Thanxs to Paul for his skeleton code) > exec ( 'egrep'. "-c", $lookFor, @{$LOGS[($_ -1)]} ) You're quite welcome, but why exec egrep? Ah, I may have misled you with

[OT] apology for inavailability

2001-06-21 Thread Paul
Hello, list. I've been in Atlanta on business for the past few days, and now have to play catch-up. My apologies for lack of contribution. =o) I'll be back when I can. = print "Just another Perl Hacker\n"; # edited for readability =o)

Re: Limiting String Length

2001-06-21 Thread Paul
--- Chuck Ivy <[EMAIL PROTECTED]> wrote: > I've got a simple message board script that I cobbled together. It > seems to have been the target of some abuse, though. > > The latest patch I'd like to apply to the code would be limiting the > length of a message posted to, say, 4096 characters. >

Re: [OT] Limiting String Length

2001-06-21 Thread Paul
--- Jeff 'japhy' Pinyan <[EMAIL PROTECTED]> wrote: > On Jun 21, Paul said: > > >--- Chuck Ivy <[EMAIL PROTECTED]> wrote: > >> I recall some programming languages treat strings as arrays of > >> characters. Is there a quick perl function or

Re: HELP ME-new to perl

2001-06-22 Thread Paul
--- sridevi arjunan <[EMAIL PROTECTED]> wrote: > Hi all, > Could anyone briefly explain the difference > between the shell script and the scripting language > like perl? lol -- Well, my gut response is to say "not really", but Brett did a pretty good job. =o) The main thing to keep in min

Re: Well...it kinda sorta works

2001-06-22 Thread Paul
--- "Brett W. McCoy" <[EMAIL PROTECTED]> wrote: > On Fri, 22 Jun 2001, Paul Burkett wrote: > > > I got a little over enthusiatic (however you spell it) > > it seems that it will work, but only for a few > > entriesshould I put the autoflush after ever

Re: comparing strings

2001-06-22 Thread Paul
--- Nick Transier <[EMAIL PROTECTED]> wrote: > Does anyone know a way to make boolean comparisons between strings? > For example, I want 'a' < 'b' to be true, but perl says 'a' == 'b' is > true. Use the string comparators. =o) 'a' lt 'b' 'a' == 'b' is true because they're both zero. 'a' eq 'b'

RE: How do I determine number of matches in a regex?

2001-06-22 Thread Paul
--- Wagner-David <[EMAIL PROTECTED]> wrote: > $count = @matches = /$pattern/g; If you don't want to save the hits, try: $count = () = /$pattern/g; __ Do You Yahoo!? Get personalized email addresses from Yahoo! Mail http://personal.mail.yahoo.

Re: comparing strings

2001-06-22 Thread Paul
--- "Jos I. Boumans" <[EMAIL PROTECTED]> wrote: > stricly speaking 'foo' == 'bar' since both should yield 3. er? print int('foo'); # prints 0 __ Do You Yahoo!? Get personalized email addresses from Yahoo! Mail http://personal.mail.yahoo.com/

Re: [OT] comparing strings

2001-06-22 Thread Paul
--- "Jos I. Boumans" <[EMAIL PROTECTED]> wrote: > yeah, rub it in... i already corrected it... not sure *what* i was > thinking... br4n3 fry... > > SORRY =) lol -- not that I would criticize a better coder. Just watching out for the nu-B's. Notice *I* didn't even *attempt* to implement Inline:

Re: A better way?

2001-06-22 Thread Paul
--- Tim Musson <[EMAIL PROTECTED]> wrote: > Hey all, > > I have this code fragment. > > if ($Var eq "String") { > &Sub($Var1); > } elsif ($Var2 =~ /$STRING/) { > &Sub($Var1); > } > > Is this a better way? > > if (($Var eq "String") || ($Var2 =~ /$STRING/)) { > &Sub($Var1); > } I

Re: to copy a file (with perl)

2001-06-25 Thread Paul
--- Stéphane JEAN BAPTISTE <[EMAIL PROTECTED]> wrote: > Hw could I copy a file in Perl the brute force approach: =o) open IN, $fileor die $!; open OUT, ">$new" or die $!; print OUT $line while defined($line=); close OUT; close IN; There are better ways, but this is a good one

Re: $select

2001-06-25 Thread Paul
--- [EMAIL PROTECTED] wrote: > Can you tell me why there is a $ at the start and end of each value ? > > $select = > "SQL$;ITMLOCCCORDER$;${company}$;N$;$;${corder}$;${item}$; There isn't. o) >From perlvar: $; The subscript separator for multidimensional array emulation. If you refer

Re: to copy a file (with perl)

2001-06-25 Thread Paul
--- Jeff 'japhy' Pinyan <[EMAIL PROTECTED]> wrote: > On Jun 25, Aaron Craig said: > > >In the spirit of TMTOWTDI - > > > >At 07:20 25.06.2001 -0700, Paul wrote: > >>the brute force approach: =o) > >> > >> open IN, $file

Re: Large File Sort

2001-06-25 Thread Paul
--- Bill Pierson <[EMAIL PROTECTED]> wrote: > Greetings all. I'm new to the list, and this is my first post, please > excuse my ignorance if I ask a question that has already been > addressed. > > I need some help finding a program or script that will merge/sort a > 250+MB file as quickly as pos

RE: Head and Tail

2001-06-25 Thread Paul
--- "Kipp, James" <[EMAIL PROTECTED]> wrote: > Why 'scalar ' ?? If I may? =o) > > open HEAD, "< $file" or die "can't read $file: $!"; This makes HEAD a filehandle to the file. push @head, ; would put the filehandle access into a list context, and would try to append the entire file to

RE: Head and Tail

2001-06-25 Thread Paul
--- "Kipp, James" <[EMAIL PROTECTED]> wrote: > > scalar > > > > puts the filehandle access into a scalar context so that it will > > only return one record each time. =o) > > without slurping the whole file !! , great thanks No problem. =o) Context is something you really have to grasp in P

Re: sort by value?

2001-06-26 Thread Paul
--- Mark Bedish <[EMAIL PROTECTED]> wrote: > I have a very simple tab delimited file containing text and numbers , > just the 2 columns and I would like to sort by ascending numeric. I > have checked Learning Perl and Prog Perl but cannot get it to work > - is that because you can only sort by ke

Re: whoami?

2001-06-26 Thread Paul
--- Matija Papec <[EMAIL PROTECTED]> wrote: > is there a more elegant way to find out who is running a script? %ENV > is not reliable and it doesn't contain USER when booting the system, > and "whoami" is external command(yuck :) ) tnx! A lot of UNIX-ish systems have an environment variable like

Re: sort by value?

2001-06-26 Thread Paul
--- Paul <[EMAIL PROTECTED]> wrote: > The problem is in this line: > > sort { $ch{1} cmp $ch{2} } keys %ch > > sort() receives the list of keys from keys %ch, and passes pairs to > be > compared to the code block { $ch{1} cmp $ch{2} } as $a and $b. Try > this:

RE: chomp ?

2001-06-26 Thread Paul
--- "Ronald J. Yacketta" <[EMAIL PROTECTED]> wrote: > OUCH! > > some people just need a gentle slap to get them going.. kind of like > a newborn ;) slap them on the arse to get them breathing. > > This was overkill ;) more like a boot to the skull! > take it easy bubba :) And after all the goo

RE: RTFM (was chomp ?)

2001-06-26 Thread Paul
--- John Edwards <[EMAIL PROTECTED]> wrote: > No. I've got to agree with Chris on this. It's not like he's asking > what bless does or something equally in-depth. Any basic perl tutorial > will explain what chomp is, and what it does. Yes and no. Supplicants should always try first, and chomp is

Re: Srting matching again

2001-06-26 Thread Paul
--- Yvonne Murphy <[EMAIL PROTECTED]> wrote: > I have the following piece of code which matches perfectly for a > string between the single qoute and the semi-colon:- > > use strict; > > my($mymatch,$line,@arr,$arr,$i); > > open (FILE, "functions2.log") or die $!; > open (OUTFILE, ">thosecool

Re: HELP! this has me rather ummm PISSED ;)

2001-06-26 Thread Paul
--- "Yacketta, Ronald" <[EMAIL PROTECTED]> wrote: Hmm... some of this code looks familiar, lol > $lookFor="Test App Finished|Fault > 2-0|ORA-|Bind|SystemError|SystemException|Communication|ORBA|Get Q > Error"; > opendir DIR, "../logs/set1/" or die "Can't open ../logs/set1/: $!"; > @allFiles

Re: curly braces

2001-06-26 Thread Paul
--- Silvio Luis Leite Santana <[EMAIL PROTECTED]> wrote: > Please > Why does code 1 work, but code 2 doesn't? > (the diference is the ; after print) > After all, is it posible or not to put a block > in place of a expression? > Thanks in advance > Silvio > > CODE 1 - WORK > > $bissexto = ; > c

Re: curly braces

2001-06-26 Thread Paul
--- Jeff 'japhy' Pinyan <[EMAIL PROTECTED]> wrote: > On Jun 26, Silvio Luis Leite Santana said: > >Why does code 1 work, but code 2 doesn't? > >(the diference is the ; after print) > >$bissexto and { print "OK\n" }; > >$bissexto and { print "OK\n"; }; > > In the first code, Perl thinks you're co

RE: HELP! this has me rather ummm PISSED ;)

2001-06-26 Thread Paul
--- "Yacketta, Ronald" <[EMAIL PROTECTED]> wrote: > > > > Try splice here: > > > >my $third = int(scalar @allfiles / 3); > >my @set = ( [ splice @allfiles, 0, $third ], # first third > > [ splice @allfiles, 0, $third ], # second third > > [ @allfiles

Re: print FN "junk\n";

2001-06-26 Thread Paul
--- "Yacketta, Ronald" <[EMAIL PROTECTED]> wrote: > Folks, > > a really DUH question here.. > > what gives, I open a FH (open OFN ">>junk.out" ); > I autoflush.. > $| = 1; That autoflushes STDOUT. Try this: open OFN, ">>junk.out" or die $!; { my $prevh = select OFN; $|=1; select $prevh; }

RE: HELP! this has me rather...

2001-06-26 Thread Paul
--- Stephen Neu <[EMAIL PROTECTED]> wrote: > :>exec $cmd, $lookFor, @{$LOGS[$_]} unless $pid=fork; # fork new > > I might be off my rocker, but do you want that to say... > unless $pid == fork; # equality, not assignment... > perhaps? If I'm off base, feel free to tell me to get lost

Re: print FN "junk\n";

2001-06-26 Thread Paul
--- Paul Johnson <[EMAIL PROTECTED]> wrote: > select((select(OFN), $| = 1)[0]); LOL!!! Cool! And a lovely pirece of cryptocontext. But I'd hate to maintain it later. =o) Not that I haven't done *FAR* worse! ;op __

Re: print FN "junk\n";

2001-06-26 Thread Paul
--- Paul Johnson <[EMAIL PROTECTED]> wrote: > On Tue, Jun 26, 2001 at 12:59:06PM -0700, Paul wrote: > > > > --- Paul Johnson <[EMAIL PROTECTED]> wrote: > > > select((select(OFN), $| = 1)[0]); > > > > LOL!!! > > Cool! And a lovely pirece

Re: print FN "junk\n";

2001-06-26 Thread Paul
--- Paul Johnson <[EMAIL PROTECTED]> wrote: > As far as syntax is concerned I thinks that has merit, but Perl has a > number of idioms that you just have to learn. Once learnt, you will > be able to write better programs and maintain others' programs. (Not > that thi

Re: size of hash?

2001-06-26 Thread Paul
--- P lerenard <[EMAIL PROTECTED]> wrote: > that's not $#hash, so it is... try scalar %hash; __ Do You Yahoo!? Get personalized email addresses from Yahoo! Mail http://personal.mail.yahoo.com/

Re: Perl Style Question

2001-06-26 Thread Paul
--- iain truskett <[EMAIL PROTECTED]> wrote: > * Gross, Stephan ([EMAIL PROTECTED]) [26 Jun 2001 22:16]: > > Why is this style > > > if ($x) { > > do this; > > do that; > > } > > > typically preferred over > > > if ($x) > > { > >do this; > >do that; > > } I always used the sec

Re: Simple Question

2001-06-26 Thread Paul
--- [EMAIL PROTECTED] wrote: > Could someone please explain the use of -> and => as in following > example? > (A poor Windows user ... ) lol > $file = "/home/images/$name"; > open(IMAGE, ">$file") || die "unable to open filehandle $file \n"; > $saveres = $ua->request(HTTP::Request->new(G

Re: Perl Style Question

2001-06-26 Thread Paul
--- iain truskett <[EMAIL PROTECTED]> wrote: > I use cuddled if what I'm doing would look silly otherwise. e.g. > > if ($blah) { > one line; > } elsif ($flurp) { > one line; > } else { > one line; > } Hey! I think that was the thing that made me switch! =o) In C I could say if

Re: Incrementing Strings

2001-06-27 Thread Paul
--- Nick Transier <[EMAIL PROTECTED]> wrote: > If I define a variable as a string > my $var = "a"; > > I can get the increment to work > print ++$var; --> prints b > > but the decrement > print --$var --> prints -1 > > Why? and how can I decrement it? Incrementing strings is magic that isn't

Re:[OT]Joining variables

2001-06-27 Thread Paul
> On 27 Jun 2001 19:56:49 +0200, Jos I. Boumans wrote: > > the obvious proof i have too much time: > > for(join'',map{$_.=$:}@{[qw(2000 05 08)]}){s/\s//g&&chop&&print} LOL!!! Is there a list award for Obfuscation of the Day? =o) Actually, that's beautiful, Jos. Bravo. ;o] _

Re: javascript

2001-06-27 Thread Paul
--- Prachi Shroff <[EMAIL PROTECTED]> wrote: > Can anyone please give any clue of how to call and execute > javascripts from perl? Assuming you're writing web content, just print the script into the content as if you were wrting a normal HTML page. It'll run when the browser reads it just the s

Re: Arrow Notation Question

2001-06-27 Thread Paul
--- "Gross, Stephan" <[EMAIL PROTECTED]> wrote: > I'm using Win32::GUI. I create a text field and call it $TextField. > The > user inputs some text, say "abc". > If I say > print "$TextField->Text"; > I get > Win32::GUI::Textfield=HASH(0x23762b0)->Text > If instead I say > $x =

Re: package

2001-06-27 Thread Paul
--- Jerry Preston <[EMAIL PROTECTED]> wrote: > What is the best source to learn to write packages? I'd go to http://www.perl.com/pub/v/documentation/ and read perlmod Perl modules: how they work perlmodlib Perl modules: how to write and use and maybe perlref

RE: using strict

2001-06-27 Thread Paul
--- Stephen Nelson <[EMAIL PROTECTED]> wrote: > Fortunately or unfortunately, you can't print to files just by using > $file > as a filehandle. You need to open the file first. > > > foreach $k (sort keys (%all_genes)) { > for (1..5){ > if ($k =~ /[$_]g/){ >

Re: Populating string (scalar)

2001-06-28 Thread Paul
--- Paul Johnson <[EMAIL PROTECTED]> wrote: > On Thu, Jun 28, 2001 at 04:42:08PM +0800, Rajeev Rumale wrote: > > I need to assign a long multiline string value to a scalar. > > > > I would like to know a way where i can assing a string value to a > > scal

Re: die / exit / style question

2001-06-28 Thread Paul
--- Ela Jarecka <[EMAIL PROTECTED]> wrote: > Hi folks, > I have a couple of doubts/questions about the usage of above > functions: > > 1. will those three always work the same ( I have troubles > understanding the > 'die' description in Llama book ( $!, $?>>8, the status of the last > reaped chi

Re: Hash of arrays

2001-06-28 Thread Paul
--- "F.H" <[EMAIL PROTECTED]> wrote: > I just wonder why the if condition is always true regardless of the > value of the array AB. > if ($testsec{'AB'}[$i] = "6543"){ # always true Because = is an assignment. =o) print "foo" if $x = "65343"; will always print, because = retu

Re: Hash of arrays

2001-06-28 Thread Paul
--- Paul <[EMAIL PROTECTED]> wrote: > > --- "F.H" <[EMAIL PROTECTED]> wrote: > > I just wonder why the if condition is always true regardless of the > > value of the array AB. > > if ($testsec{'AB'}[$i] = "6543"){

Re: simple regex question

2001-06-28 Thread Paul
--- Mike Ring <[EMAIL PROTECTED]> wrote: > I've learned a bit about regular expressions today. I have a string > formatted > like "CN=foo,OU=bar,O=pah" and I need to parse out "foo". I have > created the > following code which does work: > > $dnvalue =~ m/([^,]*)/; > $username = $1; > $username

Re:[OT:style]deleting a line with a particular string.

2001-06-28 Thread Paul
--- Me <[EMAIL PROTECTED]> wrote: > > I have a file having 100 lines. > > I want to remove the lines, having a particular string, completely > > from the file. (notreplacing them with blank lines even) > > > > Is there a way in perl for doing this ? > > At a shell prompt / command line, enter: >

Re: data matching

2001-06-28 Thread Paul
--- "F.H" <[EMAIL PROTECTED]> wrote: > Hi all, Hi. =o) > I am trying to skip any line in my input file that doesn't have a > city with a street named 'MAIN'. I am matching record[3] in my input > file with a $city (array) from a hash (%state) that I got from > another file. The problem is that

Re: data matching

2001-06-28 Thread Paul
--- Michael Fowler <[EMAIL PROTECTED]> wrote: > On Thu, Jun 28, 2001 at 02:34:31PM -0700, Paul wrote: > > > $city = $record[3] ; > > > for ($i = 0; $i <= $#{ $state{$city}; $i ++ ) { > > > > Never use the > > for( ; ; ) { } > > constru

Re: AW: short filehandle question

2001-06-29 Thread Paul
File" or die "$outFile: $!"; my $fhPIPE = new FileHandle "ls -l|"or die "ls: $!"; my $rec = <$fhIN>; my $line = <$fhPIPE>; print $fhOUT $rec; Paul = > Ela Jarecka wrote: > > > > Hi, > > It is decla

Re[OT]loop counting

2001-06-29 Thread Paul
--- Michael Fowler <[EMAIL PROTECTED]> wrote: > > for my $i (0 .. $#foo) { > > my $element = $foo[$i]; > > # ... > > } > > or > > for (my $i = 0; $i < @foo; $i++) { > ... > } > > for (;;) isn't a bad word. :) lol -- depends on where you were raised. ;o] _

Re: loop counting

2001-06-29 Thread Paul
--- Bob Mangold <[EMAIL PROTECTED]> wrote: > Is there a perl variable that automatically counts loop iterations. > Such that I don't have to use '$count': > > foreach (@array){ > $count++; > ..whatever.. > } Lot's of people with suggestions, but I have a question -- what are you using $coun

Re[OT]loop counting

2001-06-29 Thread Paul
--- Bob Mangold <[EMAIL PROTECTED]> wrote: > Within the loop, some other programs are executed and occasionally it > may take a few minutes to complete everything and then continue. So > I'm just throwing a little counter to STDOUT so I can monitor the > progress, to ensure it doesn't get hung up

Timeofday jumping

2001-06-29 Thread paul
718000 718000 718000 734000 734000 734000 See, a sudden increase of 16000 us in the middle of the same loop. Can anyone explain this? Thanks, Paul Global WebMail - Delivered by Global Internet www.global.net.uk

Re: Simple Split Question

2001-06-29 Thread Paul
--- "Seitz, Scott" <[EMAIL PROTECTED]> wrote: > I'm having trouble with what I think is a very simple split question. > > I've got a line of text something like: > > DimView 1 "All" DimView 2 "Some" DimView 3 "Most" DimView 4 "None" > > I want a hash with (1, "All", 2, "Some", 3, "Most", 4, "N

Re: Problem with hash value

2001-06-29 Thread Paul
--- Me <[EMAIL PROTECTED]> wrote: > > > my ($num) = @_; > > > > > > puts the length of @_ in $num. I don't think so? The parens should give $num a list context. It should have the first value in @_. Right? __ Do You Yahoo!? Get personaliz

Re: Matching strings

2001-07-02 Thread Paul
--- Martin van-Eerde <[EMAIL PROTECTED]> wrote: > could you walk me through @h{@vars} = () > I think it means many keys of the hash will be assigned an > undefined list. > I dont understand the @ meaning array in @h !! > > my %h; > > @h{@vars} = (); > > if (keys %h != @vars) { $youlose = "yes" }

Re: open +>>

2001-06-27 Thread Paul
--- "Randal L. Schwartz" <[EMAIL PROTECTED]> wrote: > > "Silvio" == Silvio Luis Leite Santana <[EMAIL PROTECTED]> > writes: > > Silvio> Hi all > Silvio> The camel-book and perldoc-page says about "open": > > Silvio> You may also place a + in front of any of these three > Silvio> modes t

A Split Question

2001-07-03 Thread paul
e no delimeters. Of course, I could just test the length and then use substr it all out, or even sprintf it into a new variable with a pad at the first character. But this is perl, and I reckon there are much cooler ways to do it. Any takers? Paul. ---

  1   2   3   4   5   6   7   8   9   10   >