AW: Getting to the contents of a class..

2001-06-12 Thread Ela Jarecka
> > > > foreach my $item ( keys $reqrec->myflds ) { #line 26 > > > > ... > > > > } > > If, out of the constructor you showed us above, you're > expecting the myflds > method to automatically be created, and return your hash, > it's not going to > happen. You have to define a myflds m

Re: Calling touch ...

2001-06-12 Thread Hasanuddin Tamir
On Tue, 12 Jun 2001, [EMAIL PROTECTED] > Here is the latest statements that I tried. > > system 'touch', 'test0612a.shtml'; system() returns 0 on success, other value on failure. What did you expect? If it fails to touch the file, is the path correct? Don't you need the full path to the file?

require command?

2001-06-12 Thread Max Attems
Hi, 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 use CGI; use strict; # defining variables: sub cleanup; my ($org, $adress, $mailprog,

Re: Calling touch ...

2001-06-12 Thread Jos Boumans
on a *nix system, any file created automatically get's a timestamp... as far as 'touch' goes, this might well be over kill in this case. concider the following: open O, ">foo.txt"; this creates 'foo.txt' and opens it for writing. now, if you dont write anything to it, that's your choice... and y

RE: how to create a file

2001-06-12 Thread Sally
To write to a file you would use something like: open (FILEHANDLE, ">FILENAME"); this command will overwrite anything that already exists in this file or create a new file if one doesn't already exist. Or you could use open (FILEHANDLE, ">>FILENAME"); this will open (or create) the file for a

Re: Installing new Modules problem

2001-06-12 Thread Jason . Smith
Hi, I did also try this but I get the same error "Failed to load PPM_DAT file" and then nothing seems to work even though I am in the PPM shell. Jason

Problems inserting hash value in a String.

2001-06-12 Thread ciberm3
Hi all, I have a problem using a hash variable and I don't know where is the error. Let me explain it: I have a web page with a form which user must fill in with personal data then when the user click 'Send' button the cgi I am programming starts; I have a txt file containing the name of the fiel

Re: stringify question

2001-06-12 Thread Goldin Evgeny (aka Genie)
Btw, there's a series of extracts from the "Object Oriented Perl" available at Damian's page : http://www.csse.monash.edu.au/~damian/papers/#Object_Oriented_Perl And it has the overloading mechanism included

Re: Installing new Modules problem

2001-06-12 Thread Jos Boumans
Sounds like an error somewhere during your initial installation... i recall seeing that happen more often on this list you might want to concider checking the AS support pages, or mailing them your problem hth, Jos Boumans [EMAIL PROTECTED] wrote: > Hi, > > I did also try this but I get th

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: Problems inserting hash value in a String.

2001-06-12 Thread Jos Boumans
>From a quick look at your code, here is the problem: '$postInputs{'$fields[2]'}' the single quotes will confuse your mysql you might want to concider using the following syntax, which, in general, is cleaner: ### something from a block of code i use ### sub set_code { # usage setcode($string,$

RE: require command?

2001-06-12 Thread Steve Howard
When you "rRequire" or "use" I believe it will only recognize a .pm extension. I'm pretty sure I've run into this before. (Someone correct me if I'm wrong.) When you say: require conf.cgi; it is looking for: conf.cgi.pm and not finding that. Hope this helps, Steve Howard -Original Mes

[OT] AW: Getting to the contents of a class..

2001-06-12 Thread Ela Jarecka
Sorry, but sending a message like that doesn't really help a beginner ( = a person for whom that list was created! ). Fortunately, my problem has already been solved by others ( THANKS AGAIN! ) > -Ursprüngliche Nachricht- > Von: gmsayloriii [mailto:[EMAIL PROTECTED]] > Gesendet: Dienstag,

Re: how to create a file

2001-06-12 Thread Kevin Meltzer
Also look at the perlopentut manual page: perldoc perlopentut Cheers, Kevin On Mon, Jun 11, 2001 at 08:52:26PM -0500, bdale16 ([EMAIL PROTECTED]) spew-ed forth: > I want a perl program when executed to send the data to a file such as text.txt but >i dont need to open the file first. > appare

converting standard input to an upper or lower case

2001-06-12 Thread John Pimentel
Hello all: I am wanting to reduce an "if" from this "or" I list below to "if ($ans eq "y")..." by forcing the response to a lower case "y" (like tolower, in C). The book I have does show the \l to force the next character to be lowercase, but I am still not clear how I pass (in this case a user r

Re: converting standard input to an upper or lower case

2001-06-12 Thread Jean-Matthieu Guerin
uc($myvar) => upper case lc($myvar) => lower case For your example: if (uc($ans) eq "Y") John Pimentel wrote: > > Hello all: > > I am wanting to reduce an "if" from this "or" I list below to "if ($ans eq > "y")..." by forcing the response to a lower case "y" (like tolower, in C). > The book I

Re: converting standard input to an upper or lower case

2001-06-12 Thread Simon McCaughey
- Original Message - From: John Pimentel <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, June 12, 2001 1:13 PM Subject: converting standard input to an upper or lower case > Hello all: > > I am wanting to reduce an "if" from this "or" I list below to "if ($ans eq > "y")..." b

RE: converting standard input to an upper or lower case

2001-06-12 Thread Filip Sneppe \(Yucom\)
From: John Pimentel [mailto:[EMAIL PROTECTED]] > I am wanting to reduce an "if" from this "or" I list below to "if ($ans eq > "y")..." by forcing the response to a lower case "y" (like tolower, in C). > The book I have does show the \l to force the next character to be > lowercase, but I am stil

EMail Header Munging

2001-06-12 Thread Chris Mulcahy
Greetings: I am trying to come up with a PERL script to munge the headers in SPAM email for reporting purposes. Obviously, I don't want to leave my email address in the headers when I report a SPAM to spamcop.net. Does anyone have a script that automatically munges the appropriate information f

Pushing more than 1 item onto a list

2001-06-12 Thread Charles Lu
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? _ Get your FREE download of MSN Explorer at http://ex

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: 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: Pushing more than 1 item onto a list

2001-06-12 Thread Brett W. McCoy
On Tue, 12 Jun 2001, 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? Actually, push already does that. See the perldoc on it. pop, however,

Re: Pushing more than 1 item onto a list

2001-06-12 Thread Chas Owens
On 12 Jun 2001 10:08:25 -0400, 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? >

Re: Pushing more than 1 item onto a list

2001-06-12 Thread Karthik Krishnamurthy
kat@graf-spee:~$ perldoc -f push push ARRAY,LIST Treats ARRAY as a stack, and pushes the values of LIST onto the end of ARRAY. The length of ARRAY increases by the length of LIST. Has the same effect as

Re: checking for the @ symbol

2001-06-12 Thread charles
Sure, no problem. i am writing a "control panel" of sorts for individuals to use to administrate their virtual emails on a linux based sendmail server. each client has a file in /etc/mail/include that holds tab delimited entries for their email aliases: [EMAIL PROTECTED] [EMAIL PROTECTED] th

RE: Getting Perl to interact with passwd

2001-06-12 Thread Daniel Ames
On Tue, 12 Jun 2001, Paul wrote: > --- 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

dir delim and files with spaces

2001-06-12 Thread me meagain
I was wondering if anyone could tell me if there is a variable for the directory delimiter... ie. "/" or "\". If not, what is the best way to go about figuring out which system you are on and acting accordingly. I know about the $^O var. Suggestions? Another prob.? I am also trying to inp

found one of my probs

2001-06-12 Thread me meagain
Found the mistake for the files with the "". Was using while (<@ARGV>) instead of while (@ARGV). Get 250 color business cards for FREE! http://businesscards.lycos.com/vp/fastpath/

testing on email characters

2001-06-12 Thread charles
if ( $add_alias =~ /\@/ ) { right now i am testing a variable to see if it contains an \@ character. i would prefer to test it to see if it has anything *other* than a-zA-Z0-9\.\-\_ can i do this with a regex like if ( $add_alias =~ /[^a-zA-Z0-9\.\-\_]/ ) { i am not certain if my sear

use of split command

2001-06-12 Thread Stephen Henderson
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 actual data is a 2 column tab delimited file like: <<...OLE_Obj...>

Re: checking for the @ symbol

2001-06-12 Thread Aaron Craig
At 09:29 12.06.2001 -0500, you wrote: >i am printing to the file currently via: > > open(FILE, ">>$filename"); > print FILE "$add_alias\@$domain\t$add_destination\n"; > close(FILE); > >so i am appending the appropriate domain to the new alias they are >entering. overall, i wan

Re: dir delim and files with spaces

2001-06-12 Thread Hasanuddin Tamir
On Tue, 12 Jun 2001, me meagain <[EMAIL PROTECTED]> wrote, > I was wondering if anyone could tell me if there is a variable for > the directory delimiter... ie. "/" or "\". > > If not, what is the best way to go about figuring out which system > you are on and acting accordingly. I know about th

Re: use of split command

2001-06-12 Thread Aaron Craig
I don't imagine you pick up all that much extra speed by reading the whole file into an array first (anyone?). I would do something like open(ACCS, "Accession.txt") || die "blah"; my %values; while() { chomp $_; my($col1, $col2) = split(/\t/, $_); # you better be sure

Re: checking for the @ symbol

2001-06-12 Thread charles
> print "You're cheating!" if($add_alias =~ /[^\w\.\-]/g); # \w Match a > "word" character (alphanumeric plus "_") > wow. thanks. that looks just like what i need. however, i also want to match the _ character as well. so will /[^\w\.\-\_]/ work for me?

Displaying text formats in a text widget...

2001-06-12 Thread Brennan, Corey
I am trying to convert a script to Perl/Tk and I am having trouble. I have some formats defined example: format DATA_OUT_TOP = col1 col2 col3 --- . format DATA_OUT = @|@|@|| $text $text1 $text2 . And I am looking for a way to use th

Re: testing on email characters

2001-06-12 Thread Jos Boumans
try this: unless (/^[-\.\w]+$/) { print "you cheater!" } this will check if from beginning to end of $_ it contains - . (not even sure you need to \ the . ) or any word character (a-z A-Z and _ ) the ^ says to start at the beginning of the string... the $ says to read till end of line... i'm o

Re: checking for the @ symbol

2001-06-12 Thread Chas Owens
On 12 Jun 2001 10:24:23 -0500, [EMAIL PROTECTED] wrote: > > print "You're cheating!" if($add_alias =~ /[^\w\.\-]/g); # \w Match a > > "word" character (alphanumeric plus "_") > > > > wow. thanks. that looks just like what i need. however, i also > want to match the _ character as wel

Displaying text formats in a text widget...(2)

2001-06-12 Thread Brennan, Corey
Sorry if this comes twice, but I think I had a problem sending it the first time. >I am trying to convert a script to Perl/Tk and I am having trouble. I have some formats defined > >example: > >format DATA_OUT_TOP = >col1 col2 col3 >--- >. > >format DATA_OUT =

Re: checking for the @ symbol

2001-06-12 Thread Hasanuddin Tamir
On Tue, 12 Jun 2001, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote, > > print "You're cheating!" if($add_alias =~ /[^\w\.\-]/g); # \w Match a > > "word" character (alphanumeric plus "_") > > > > wow. thanks. that looks just like what i need. however, i also > want to match the _ charac

making a variable name a variable value?

2001-06-12 Thread Chirag Patel
Hi there, I was wondering how to make a variable name the value of another variable. Do we do this using pointers? for example: $name = "jerry"; how can I establish a variable with the name $jerry ? thanks for the help, c.

Re: testing on email characters

2001-06-12 Thread Chas Owens
On 12 Jun 2001 17:45:16 +0200, Jos Boumans wrote: > try this: > > unless (/^[-\.\w]+$/) { print "you cheater!" } > > this will check if from beginning to end of $_ it contains - . (not even sure > you need to \ the . ) or any word character (a-z A-Z and _ ) > > the ^ says to start at the beginn

Any recommendations for a PGP module?

2001-06-12 Thread Mark Ross
Hi all, I was wondering if anyone has a recommendation for a module that can encrypt data via PGP. I've looked on CPAN, and there's a couple that seem to do what I want. I was just wondering if the gurus out there could offer their input on the good ones (how 'bout Crypt::PGP5 ?) Thanks, --Mark.

what does perl do internally when filehandles are undefined?

2001-06-12 Thread Avram Aelony
Hi, I commonly make use of statements like: print OUTFILE "Print results, data, or anything else\n"; This is normally preceded by defining my file handle, as in something like: open(OUTFILE, ">newfile.txt"); I'd like to know what *actually* happens internally if the filehandle, OUTFILE i

Re: making a variable name a variable value?

2001-06-12 Thread Chas Owens
On 12 Jun 2001 09:15:37 -0700, Chirag Patel wrote: > Hi there, > > I was wondering how to make a variable name the value of another variable. > Do we do this using pointers? > > for example: > $name = "jerry"; > > how can I establish a variable with the name > $jerry ? > > thanks for the help,

Re: making a variable name a variable value?

2001-06-12 Thread Kevin Meltzer
This is possible to do, but please read http://perl.plover.com/varvarname.html before doing so (the article also shows how to do, as well as explains why you shouldn't). Cheers, Kevin On Tue, Jun 12, 2001 at 09:15:37AM -0700, Chirag Patel ([EMAIL PROTECTED]) spew-ed forth: > Hi there, > > I was

Re: checking for the @ symbol

2001-06-12 Thread Aaron Craig
At 11:50 12.06.2001 -0400, Chas Owens wrote: >\w includes _. The \w character set is anything that can be included >in a variable name. On the topic of shortening the regexp: "." in a >character class does not need to be escaped so you can write it like >this > > print "You're cheating!" if($a

Sorting two parallel arrays

2001-06-12 Thread Martin van-Eerde
What I need to do is sort the data in the second array in ascending order and then print out with the corresponding elements from the first array. It seems to work, apart from being in descending order, but my main problem is perl complaining about a depreciated use of split @ Thanks for any

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

Remote command execution on NT and Solaris?

2001-06-12 Thread Michael Dube
I have just begun a project that will involve automated state setting on multiple machines across multiple platforms (NT & Solaris). At this point I believe this will be done by writing scripts for each platform and having a centralized system (NT or Solaris) execute a script which will instruct

beginners@perl.org

2001-06-12 Thread [EMAIL PROTECTED]
unsubscribe

map function has me confused!

2001-06-12 Thread Tom Watson
Hi all! The problem is this: I don't fully understand how, when or why to use the map function - The first book I got on perl only mentions map in passing and says its syntax is the same as grep, but instead of returning $_, it returns the result of the map expression. Now, if i try the cod

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 Michael Fowler
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 that it breaks encapsulation. Judging from this what you really

RE: making a variable name a variable value?

2001-06-12 Thread John Pimentel
Forgive me if I'm missing something, but I've used the following: $varnew = "$varold" ; $varnew will return the same value as $varold did/does. Just like if you wanted to initialize a bunch of counters: $ctr1 = $ctr2 = $ctr3 = $ctr4 = 1; . I don't know that it is proper form, but it seems to

Re: map function has me confused!

2001-06-12 Thread Me
> I don't fully understand how, when or why to use the map function - > > my @file = ("line 1", "line 2", "line 3", "line 4", "line 5"); > my @test = map {/5/} @file; > > The result when I print @test is: > 1 > > As I understand things, this is the m/5/ being "true" Sorta. It's the length of

Re: testing on email characters

2001-06-12 Thread Jos Boumans
Please, if you try and flame posts, get your facts straight. 1st: - is a range operator, and hence needs not be escaped when it's not indicating a range, ie, at the beginning or end of a [] so this regex is not 'wrong'. feel free to try it. 2nd:the regex is purposely written ver

Re: map function has me confused!

2001-06-12 Thread Me
> > I don't fully understand how, when or why to use the map function - > > > > my @file = ("line 1", "line 2", "line 3", "line 4", "line 5"); > > my @test = map {/5/} @file; > > > > The result when I print @test is: > > 1 > > > > As I understand things, this is the m/5/ being "true" > > Sort

Re: require command?

2001-06-12 Thread Max Attems
dear tmk and steve, thanks for your help! i gave the full path to the require command and it worked!! my conf.cgi was full of errors, but i was quite happy to go further on and could fix them. now conf.cgi is ok but still, i get this error message, which i couldn't fix: Use of uninitialized val

RE: making a variable name a variable value?

2001-06-12 Thread Chas Owens
On 12 Jun 2001 12:38:48 -0400, John Pimentel wrote: > Forgive me if I'm missing something, but I've used the following: > $varnew = "$varold" ; > > $varnew will return the same value as $varold did/does. > > Just like if you wanted to initialize a bunch of counters: $ctr1 = $ctr2 = > $ctr3 = $c

Re: what does perl do internally when filehandles are undefined?

2001-06-12 Thread Jos Boumans
Hello, > I commonly make use of statements like: print OUTFILE "Print > results, data, or anything else\n"; > This is normally preceded by defining my file handle, as in something > like: open(OUTFILE, ">newfile.txt"); > > Or does print (or printf for that matter) recognize that no such >

RE: map function has me confused

2001-06-12 Thread Tom Watson
>me said: >> How would I go about creating a second array using map >> or grep without changing the original? Can I do that at all? >@foo = @bar; Sorry, I should have been clearer on this question. What I was looking for is a way to take an element from @foo - change it in some way, and pla

Re: map function has me confused!

2001-06-12 Thread Me
Er, self-correction self-correction: > First: > /5/ =~ "line 5"; > > is done in list context. More accurately, something like: $_ = "line 5"; @onemap = (/5/); push (@allmaps, @onemap); where @onemap is really an unnamed internal list not available to your perl code and @allmap

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

Re: what does perl do internally when filehandles are undefined?

2001-06-12 Thread Hasanuddin Tamir
On Tue, 12 Jun 2001, Avram Aelony <[EMAIL PROTECTED]> wrote, > Hi, > > I commonly make use of statements like: print OUTFILE "Print > results, data, or anything else\n"; > This is normally preceded by defining my file handle, as in something > like: open(OUTFILE, ">newfile.txt"); > > I'd

Re: Sorting two parallel arrays

2001-06-12 Thread Michael Fowler
On Tue, Jun 12, 2001 at 05:14:19PM +0100, Martin van-Eerde wrote: > Thanks for any help! > > my @first = qw(high medium low apex); > my @second = qw(100.00 50.50 34.25 23.99); > > > my $idx = -1; > my @result = map {$idx ++; $second[$idx].'~'.$_} @first; > > print "merge result:\n"; > print jo

Re: map function has me confused

2001-06-12 Thread Me
> What I was looking for is a way to take an > element from @foo - change it in some way, > and place it in @bar without changing the > original element of @foo but do it in one > line of code: Well, I'd still be inclined to do something like: @foo = @bar; for (@foo) { s/qux/waldo/ }; e

Re: [META] Rants (was:Re: space)

2001-06-12 Thread Randal L. Schwartz
> "Aaron" == Aaron Craig <[EMAIL PROTECTED]> writes: Aaron> My whole issue with the thing is that we've been forced to find a Aaron> workaround. If one of the goals of good programming is to do away Aaron> with unnecessary bullox, then shouldn't this list, as an example to Aaron> beginning p

Re: map function has me confused

2001-06-12 Thread Tom Watson
>me said: > And you want it in one simple statement? I don't think > it can be done, depending on one's definition of simple. > > Here's my best shot: > > map { my $foo = $_; $foo =~ s/qux/waldo/ and $foo } @bar; Actually it was more of a question if it can't be done well, that's ok too

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: map function has me confused

2001-06-12 Thread Michael Fowler
On Tue, Jun 12, 2001 at 05:56:17PM +0100, Tom Watson wrote: > I was thinking it might be possible to do this in one line using map..? Well, there's: @new = map { my $tmp = $_; $tmp =~ s/foo/bar/; $tmp; } @original; OR (this is bad form, you shouldn't use map in void context) map {

ensuring that there *is* an \@ symbol

2001-06-12 Thread charles
i am trying: } elsif ( $add_destination !=~ /\@/ ) { which is not working. i am hoping that this reads "if $add_destination does NOT contain \@ then" however, it apparently does not read this way :) is my error in perl syntax or the regex? thanks! -charles

Re: testing on email characters

2001-06-12 Thread Chas Owens
On 12 Jun 2001 18:45:23 +0200, Jos Boumans wrote: > Please, if you try and flame posts, get your facts straight. > > 1st: - is a range operator, and hence needs not be escaped when it's not > indicating a range, ie, at the beginning or end of a [] > so this regex is not 'wrong'. fee

RE: ensuring that there *is* an \@ symbol

2001-06-12 Thread Wagner-David
you need only !~ for does not contain vs =~ does contain Wags ;) -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Tuesday, June 12, 2001 11:16 To: Perl Discuss Subject: ensuring that there *is* an \@ symbol i am trying: } elsif ( $add_destination !=~ /\@/

RE: ensuring that there *is* an \@ symbol

2001-06-12 Thread Peter Cornelius
> i am trying: > > } elsif ( $add_destination !=~ /\@/ ) { > > which is not working. i am hoping that this reads "if $add_destination > does NOT contain \@ then" > > however, it apparently does not read this way :) > is my error in perl syntax or the regex? I think the syntax you want is '!~

Re: ensuring that there *is* an \@ symbol

2001-06-12 Thread Peter Scott
At 01:16 PM 6/12/01 -0500, [EMAIL PROTECTED] wrote: >i am trying: > > } elsif ( $add_destination !=~ /\@/ ) { > >which is not working. i am hoping that this reads "if $add_destination >does NOT contain \@ then" > >however, it apparently does not read this way :) Quite :-) You want the !~ opera

Re: ensuring that there *is* an \@ symbol

2001-06-12 Thread Chas Owens
On 12 Jun 2001 13:16:26 -0500, [EMAIL PROTECTED] wrote: > i am trying: > > } elsif ( $add_destination !=~ /\@/ ) { > > which is not working. i am hoping that this reads "if $add_destination > does NOT contain \@ then" > > however, it apparently does not read this way :) > is my error in perl

Re: map function has me confused

2001-06-12 Thread Randal L. Schwartz
> "Michael" == Michael Fowler <[EMAIL PROTECTED]> writes: Michael> On Tue, Jun 12, 2001 at 05:56:17PM +0100, Tom Watson wrote: >> I was thinking it might be possible to do this in one line using map..? Michael> Well, there's: Michael> @new = map { my $tmp = $_; $tmp =~ s/foo/bar/; $

Re: map function has me confused

2001-06-12 Thread Chas Owens
On 12 Jun 2001 11:32:46 -0700, Randal L. Schwartz wrote: > For this, I much prefer: > > s/foo/bar/ for @new = @original; > > And it's even less typing! Could you break this down into English? -- Today is Pungenday, the 17th day of Confusion in the YOLD 3167 P'tang!

Re: testing on email characters

2001-06-12 Thread Michael Fowler
On Tue, Jun 12, 2001 at 02:19:23PM -0400, Chas Owens wrote: > /[\W.-]/ expands to /[[^a-zA-Z0-9_].-]/ Conceptually, yes, but the pattern /[[^a-zA-Z0-9_].-]/ isn't going to give you what you seem to expect if you were to actually try to use it. \w, \W, \d, \D, and friends are magic like that; the

Re: map function has me confused

2001-06-12 Thread Randal L. Schwartz
> "Chas" == Chas Owens <[EMAIL PROTECTED]> writes: Chas> On 12 Jun 2001 11:32:46 -0700, Randal L. Schwartz wrote: Chas> >> For this, I much prefer: >> >> s/foo/bar/ for @new = @original; >> >> And it's even less typing! Chas> Chas> Could you break this down into English? Copy @origin

Re: Displaying text formats in a text widget...

2001-06-12 Thread Jeff 'japhy' Pinyan
On Jun 12, Brennan, Corey said: >I am trying to convert a script to Perl/Tk and I am having trouble. I have >some formats defined I've no clue how you'd get formats to write() to a Tk widget... you'd have to use formline() and the $^A variable, methinks. But have no fear -- I'm in the process

Re: Sorting two parallel arrays

2001-06-12 Thread Jeff 'japhy' Pinyan
On Jun 12, Martin van-Eerde said: >What I need to do is sort the data in the second array in ascending >order and then print out with the corresponding elements from the >first array. > >It seems to work, apart from being in descending order, but my >main problem is perl complaining about a de

simple Perl question

2001-06-12 Thread YurikoCutie928
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

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: simple Perl question

2001-06-12 Thread Wagner-David
Unsure exactly what you are really after, but you would code your program into subs with one while loop or some controlling mechanism which would allow you to go where you wanted within your program. sub suba { } sub subb { } sub subcc { } while ( 1 ) { print "Please enter value:"

pulling 1 key from a hash

2001-06-12 Thread Big Bird
I'm converting a massive fixed width file to a delimited one, but the file has some fields missing. It's my job to try to deduce the value of each missing field from another one present in that line of the file. One example is deducing the missing zip code given the city field. I have a hash

Re: pulling 1 key from a hash

2001-06-12 Thread Rev. Jonathan T Sage
well, there may be more efficient means but something like this shoudl do the trick. sub returnkey { foreach $zipcode (keys %hash) { if ( $hash{$control} eq $cityname ) { return $zipcode; } } } ~jon --- Big Bird <[EMAIL PROTECTED]> wrote: > I'm converting a massive fixed width file to a

Re: pulling 1 key from a hash

2001-06-12 Thread Rev. Jonathan T Sage
And, in an amzingly stupid manner, here's a correction to that code. sorry. --- "Rev. Jonathan T Sage" <[EMAIL PROTECTED]> wrote: > well, there may be more efficient means but something like this shoudl do the > trick. > > sub returnkey { > foreach $zipcode (keys %hash) { > if ( $hash{$zi

Re: [META] Rants (was:Re: space)

2001-06-12 Thread Mark Folse
Having further considered, I agree with not munging. I've not run lists but I've run mail servers, so lets not make anything messier that we don't need to. Next we'll be mucking with DNS resolvers for our local convenience, as it appears Win2000 has done. Yikes! I would recommend anyone who wants

Re: [META] Rants (was:Re: space)

2001-06-12 Thread Karen Cravens
On 12 Jun 2001, at 10:42, Randal L. Schwartz wrote: > It already is. It doesn't force a reply-to, where beginners > invariably end up replying to the list when they mean to reply to a > person. Hmm. Epiphany... I think the fundamental difference in viewpoints here depends on the fundamental

Re: pulling 1 key from a hash

2001-06-12 Thread Michael Fowler
On Tue, Jun 12, 2001 at 08:23:43PM -, Big Bird wrote: > I have a hash of zipcode-city pairs. Since a city may have more than one > zip code, the zipcodes are the keys. If there is exactly 1 value in the > hash that matches the city in the line of the file, I need to get the key > for that

checking the status of FileHandle

2001-06-12 Thread Charles Lu
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,">$temp.txt") or die "Can't open the file\n"; $oldhandle =

Re: what does perl do internally when filehandles are undefined?

2001-06-12 Thread Hasanuddin Tamir
On Tue, 12 Jun 2001, Avram Aelony <[EMAIL PROTECTED]> wrote, > I agree with you, but my question really is this: What happens if there is no > open() statement at all?? > What if you *only* have this: print FILE "test\n"; > > Does the string "test" get executed and go nowhere or does

Whats my problem, among other things?

2001-06-12 Thread T&R Customer Service
- Original Message - From: Richard and Bonnie Taft To: Sent: Tuesday, June 12, 2001 10:18 AM Subject: Whats my problem, among other things? TO all you perl faithful who are in the know: I am trying to test my perl scripts on a win98 machine running PWS. I have all downloaded and inst

Re: [META] Rants (was:Re: space)

2001-06-12 Thread Kevin Meltzer
Let me repeat, *this thread is closed*. There will be no more discussion about header munging, unless it is how Perl can do header munging. Ask has given his response on the headers issue, and I have closed this thread. You know how the headers work, so you know what you need to do to reply to a

Re: checking the status of FileHandle

2001-06-12 Thread Hasanuddin Tamir
On Tue, 12 Jun 2001, Charles Lu <[EMAIL PROTECTED]> wrote, > my $oldhandle=undef; > if($user_input ne 'STDOUT') { #user specify output to a file > open (OUT,">$temp.txt") or die "Can't open the file\n"; > $oldhandle = select OUT; > } > > print "blah blah blah\n"; > > select ($ol

Re: use of split command

2001-06-12 Thread Evgeny Goldin (aka Genie)
> I am trying to read a quite large file (ca 13000 lines) directly into an > array (for speed) Sorry, it's a bad idea. One day your file will be 1 GB size and @ets= will kill your PC trying to load the whole gig into the memory .. while ( ){..} is the best way for reading large files, I think

Re: making a variable name a variable value?

2001-06-12 Thread Evgeny Goldin (aka Genie)
If you're running your script under 'use strict' ( and you'd better do it always, I think ) - it contains use strict "refs" which doesn't allow you to use a symbolic references ( ${"aaa"} is $aaa ) This saves you from dereferencing a wrong variable : ${ $variable } - if $variable is occasio

Re: converting standard input to an upper or lower case

2001-06-12 Thread Evgeny Goldin (aka Genie)
> if ($ans =~ /^y$/i) Other people pointed the "if ( lc($ans) eq 'y' )" solution and it should go _much_ faster then using a regex .. Don't try to push regexes whenever you can - eq, index, substr may do a lot for you.

  1   2   >