Re: grep (small doubt)

2002-04-02 Thread Mandar Rahurkar
well, i got a solution : @list= glob "*[d]?_vow*.fea"; Thanks Anyways Mandar On Wed, 3 Apr 2002, Sudarsan Raghavan wrote: > Mandar Rahurkar wrote: > > > Hi, > > Its me again.. > > > > 169b2_vow_band_1.fea > > 2168d6_vow_band_1.fea > > > > @files = grep /^.{3}g[^1].*\.fea$/, @files; > > >

Re: grep (small doubt)

2002-04-02 Thread Mandar Rahurkar
I am using following regexp : $skip=1; @list_neutral=grep /^.{3,4}[^d][^skip].*\.fea$/, @list; this does not match as 3|4 option matches everything :( Mandar On Wed, 3 Apr 2002, Sudarsan Raghavan wrote: > Mandar Rahurkar wrote: > > > Hi, > > Its me again.. > > > > 169b2_vow_band_1.fea >

Re: grep (small doubt)

2002-04-02 Thread Sudarsan Raghavan
Mandar Rahurkar wrote: > Hi, > Its me again.. > > 169b2_vow_band_1.fea > 2168d6_vow_band_1.fea > > @files = grep /^.{3}g[^1].*\.fea$/, @files; > > can i have an or like for eg : > @files = grep /^.{3|4}g[^1].*\.fea$/, @files; > You can write it as /^.{3,4}g(?!1).*\.fea$/ .{3,4} matches

Re: grep

2002-04-02 Thread John W. Krahn
Sudarsan Raghavan wrote: > > Mandar Rahurkar wrote: > > > Thanks a million guys my prob is solved. > > Could you please tell me which are good references for regular expressions > > for perl ... > > You can start with > perldoc perlretut > perldoc perlre http://www.oreilly

Re: grep (small doubt)

2002-04-02 Thread Mandar Rahurkar
Hi, Its me again.. 169b2_vow_band_1.fea 2168d6_vow_band_1.fea @files = grep /^.{3}g[^1].*\.fea$/, @files; can i have an or like for eg : @files = grep /^.{3|4}g[^1].*\.fea$/, @files; Many Thanks Mandar -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PR

Re: grep

2002-04-02 Thread Sudarsan Raghavan
Mandar Rahurkar wrote: > Thanks a million guys my prob is solved. > Could you please tell me which are good references for regular expressions > for perl ... You can start with perldoc perlretut perldoc perlre > > > Many Thanks > Mandar > > On Tue, 2 Apr 2002, John W. Krahn

Re: grep

2002-04-02 Thread Mandar Rahurkar
Thanks a million guys my prob is solved. Could you please tell me which are good references for regular expressions for perl ... Many Thanks Mandar On Tue, 2 Apr 2002, John W. Krahn wrote: > Sudarsan Raghavan wrote: > > > > Mandar Rahurkar wrote: > > > > > thanks to everyone for replyin

Re: file downloading

2002-04-02 Thread A. Rivera
Just post the file and let someone click on the URL link to it? - Original Message - From: "Mariusz" <[EMAIL PROTECTED]> To: "perl" <[EMAIL PROTECTED]> Sent: Tuesday, April 02, 2002 9:50 PM Subject: file downloading hi, I'm creating a html page on which I would like the viewers to be a

Re: grep

2002-04-02 Thread John W. Krahn
Sudarsan Raghavan wrote: > > Mandar Rahurkar wrote: > > > thanks to everyone for replying however I think i failed to define the > > problem accurately : > > > > i have files assigned to @files variable : > > > > 2168a5_vow_band_1.fea > > 169b2_vow_band_1.fea > > 2168d6_vow_band_1.fea > > 2168

Re: grep

2002-04-02 Thread Sudarsan Raghavan
Sudarsan Raghavan wrote: > Mandar Rahurkar wrote: > > > Hi, > > thanks to everyone for replying however I think i failed to define the > > problem accurately : > > > > i have files assigned to @files variable : > > > > 2168a5_vow_band_1.fea > > 169b2_vow_band_1.fea > > 2168d6_vow_band_1.fea > >

file downloading

2002-04-02 Thread Mariusz
hi, I'm creating a html page on which I would like the viewers to be able to download my pdf file. I know how to upload a file using perl but what about downloading? Or maybe I should use something else? Could someone tell me how it is usually done on peoples websites (downloading files)? Big

Re: grep

2002-04-02 Thread Mandar Rahurkar
hey, Thanks a lot.How is negation used for eg ^1 for no ones I tried ^1 as in shell.doesnt work !! Thanks Mandar On Wed, 3 Apr 2002, Sudarsan Raghavan wrote: > Mandar Rahurkar wrote: > > > Hi, > > I need to select particular files from list that looks like this : > > > > 2168a5_vow_band_1.

Re: grep

2002-04-02 Thread Sudarsan Raghavan
Mandar Rahurkar wrote: > Hi, > thanks to everyone for replying however I think i failed to define the > problem accurately : > > i have files assigned to @files variable : > > 2168a5_vow_band_1.fea > 169b2_vow_band_1.fea > 2168d6_vow_band_1.fea > 2168d5_vow_band_1.fea > 169g3_vow_band_1.fea > n

Re: grep

2002-04-02 Thread Mandar Rahurkar
Hi, thanks to everyone for replying however I think i failed to define the problem accurately : i have files assigned to @files variable : 2168a5_vow_band_1.fea 169b2_vow_band_1.fea 2168d6_vow_band_1.fea 2168d5_vow_band_1.fea 169g3_vow_band_1.fea neutral.txt And i want the files say for eg su

Re: grep

2002-04-02 Thread Sudarsan Raghavan
Mandar Rahurkar wrote: > Hi, > I need to select particular files from list that looks like this : > > 2168a5_vow_band_1.fea > 169b2_vow_band_1.fea > 2168d6_vow_band_1.fea > 169g3_vow_band_1.fea > neutral.txt > > This is how the list if files look like.I need files with only g for > eg > I can d

Re: grep

2002-04-02 Thread Eric Plowe
Mandar, Grep will work in perl.. tho you could do it otherways..since you're asking about grep..i'll do it with grep... I a sure you're familar with how to open and read a directory..etc..so I wont add that... here ya go @filesearch = (grep /[gG]/, @files) //the [gG] searches for any instan

grep

2002-04-02 Thread Mandar Rahurkar
Hi, I need to select particular files from list that looks like this : 2168a5_vow_band_1.fea 169b2_vow_band_1.fea 2168d6_vow_band_1.fea 169g3_vow_band_1.fea neutral.txt This is how the list if files look like.I need files with only g for eg I can do it in linux as fo

Re: Spliting a string on "."

2002-04-02 Thread Jeff 'japhy' Pinyan
On Apr 3, Rajeev Rumale said: >I am not able to split the the string "12.12.1975" on the "." seprator. > >also when I try ot repace the dot with some other variable useing the >statement $date=~s/./#/g; The character . is a special character for regexes. If you want it to match a LITERAL dot, y

Spliting a string on "."

2002-04-02 Thread Rajeev Rumale
Hi I have a sub routine listed at end. I request you to kindly tell me the mistake in this. I am not able to split the the string "12.12.1975" on the "." seprator. also when I try ot repace the dot with some other variable useing the statement $date=~s/./#/g; It is repalcing all the charc

Re: CGI.pm & PPM

2002-04-02 Thread drieux
On Tuesday, April 2, 2002, at 07:58 , Bob T wrote: > In order to have perl work as a cgi scripter are any modules besides CGI. > pm > actually needed?? I dropped it all off of vladimir, then had to run back to the CPAN to pick Up: HTML-Tagset-3.03 URI-1.18 Compress-Zlib-1.16HTML-Tr

CGI.pm & PPM

2002-04-02 Thread Bob T
In order to have perl work as a cgi scripter are any modules besides CGI.pm actually needed?? Question #2.. I have use PPM with windows and I like the features and ease. Does a Linux version exsist??? Bob T -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL P

Re: HTML whine

2002-04-02 Thread drieux
On Tuesday, April 2, 2002, at 05:26 , Tagore Smith wrote: [..] > Not to nitpick (but I'm going to anyway :) ), but closing some tags (like > p) > is optional in all versions of HTML based on SGML. [..] except of course the versions of the HTML dtd's that mandate it and for which .. given th

Re: perl equivalent

2002-04-02 Thread drieux
On Tuesday, April 2, 2002, at 04:39 , Anand, Pankaj wrote: > I need a small help . nothing untoward - you might like: http://www.wetware.com/drieux/CS/lang/shellScript/ [..] I'll not try to be TOO harsh about some of what you could have done to make that /bin/sh script less, well... issue laden

Re: perl equivalent

2002-04-02 Thread John W. Krahn
Pankaj Anand wrote: > > Hi , Hello, > I need a small help . > I have one script with these commands.But I think perl can do it > efficiently. > > What will be the perl equivalent for this - > grep UNBIND $file|tr "=" " "|awk '{print $4}' > /tmp/con > for i in `cat /tmp/con` > do > ip=`grep $i

Re: Converting Unix time...

2002-04-02 Thread James Taylor
Look into Time::Local Daniel Falkenberg wrote: >G'day all, > >What would be the best way of converting Unix time into a ddmmyy format? >I am a little stuck with this so any ideas would be greatly appriciated. > >Dan > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-

Re: HTML whine

2002-04-02 Thread Tagore Smith
Jonathan E. Paton wrote: > Closing HTML tags is part of the specification, i.e. > not optional for syntactically correct HTML. > > Such HTML only works with most browsers due to the > proliferation of badly coded HTML. If it wasn't > for that, then browsers wouldn't have such a hard > time parsi

Re: FW: Time arithmetics...

2002-04-02 Thread drieux
On Tuesday, April 2, 2002, at 04:09 , Jonathan E. Paton wrote: > I think we should petition our OS designers to think > ahead. The short-sightedness of programmers caused > the Y2K issue, we should avoid repeating our mistakes. like dude, relax. according to Moore's law the last CPU upgrade o

perl equivalent

2002-04-02 Thread Anand, Pankaj
Hi , I need a small help . I have one script with these commands.But I think perl can do it efficiently. What will be the perl equivalent for this - grep UNBIND $file|tr "=" " "|awk '{print $4}' > /tmp/con for i in `cat /tmp/con` do ip=`grep $i $file |grep from |awk '{print $8}'` op=`grep $i $fil

Re: 2 questions

2002-04-02 Thread Eric Plowe
sheesh - that's a lot easier then the way I do it :P thanks. ~Eric On Tuesday, April 2, 2002, at 07:09 PM, John W. Krahn wrote: > Glenn Cannon wrote: >> >> Hi all, > > Hello, > >> Couple of questions from a newbie... >> >> 1) How can I print the current directory name? > > use Cwd; > my $dir =

Re: HTML whine

2002-04-02 Thread Jonathan E. Paton
> > while ( my($first, @full_list)=$list_tbl->fetchrow){ > > print ""$first; > > } > > technically I LIKE the answer, but PLEASE close it!!! > > print "" . $first . "" ; > > the more of these that we get in the habit of making > kosher - the better. Closing HTML tags is part of the s

Re: 2 questions

2002-04-02 Thread John W. Krahn
Glenn Cannon wrote: > > Hi all, Hello, > Couple of questions from a newbie... > > 1) How can I print the current directory name? use Cwd; my $dir = cwd; print "The current directory is $dir\n"; > 2) How can I check to see if a file I know the name of exists? if ( -e $filename ) { pri

Re: FW: Time arithmetics...

2002-04-02 Thread Jonathan E. Paton
> This is a problem for us historians. I would hope > that perl designers, among others, are thinking > about wide date ranges... AFAIK the Linux kernel people are complaining about having a year 40 (1sf) problem. Obviously, if time travel becomes possible then we'll need a range of several

RE: 2 questions

2002-04-02 Thread Timothy Johnson
To check if a file exists, you might be better off using the built-in file tests. if(-e $file){ Do something... }else{ Do something else... } -Original Message- From: Eric Plowe [mailto:[EMAIL PROTECTED]] Sent: Tuesday, April 02, 2002 4:03 PM To: Glenn Cannon Cc: [EMAIL PROTECTED

Converting Unix time...

2002-04-02 Thread Daniel Falkenberg
G'day all, What would be the best way of converting Unix time into a ddmmyy format? I am a little stuck with this so any ideas would be greatly appriciated. Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: 2 questions

2002-04-02 Thread Eric Plowe
Glenn.. to print the current directory name...try --- #!/usr/bin/perl -w use strict; use Cwd; $curr = cwd(); print "$curr\n"; easy enough this is bit longer example.. you could prolly do it another way..but this is how *I* would do it --- #!/usr/bin/perl -w use strict; use Cwd; my $cur

Re: Filehandles named with a variable

2002-04-02 Thread Jenda Krynicky
From: Mr Hash <[EMAIL PROTECTED]> > $1 is the resultant of a regex match. It don't need to be around very > long, because I build a hash of open filehandles (key = filehandle > string, value = file) at the time I open the file. > > And no, I don't close 'em! exit() does just fine. Something lik

2 questions

2002-04-02 Thread Glenn Cannon
Hi all, Couple of questions from a newbie... 1) How can I print the current directory name? 2) How can I check to see if a file I know the name of exists? Thx, Glenn -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Filehandles named with a variable

2002-04-02 Thread Mr Hash
$1 is the resultant of a regex match. It don't need to be around very long, because I build a hash of open filehandles (key = filehandle string, value = file) at the time I open the file. And no, I don't close 'em! exit() does just fine. On 04/02, Timothy Johnson said something like: > > You RE

RE: regex excluding \w.\w\w\w.\w

2002-04-02 Thread Jason Larson
> -Original Message- > From: Teresa Raymond [mailto:[EMAIL PROTECTED]] > Subject: regex excluding \w.\w\w\w.\w > > I'm trying to figure out how to exclude upload files with 2 periods > at the end (b/c of that virus which I forgot the name of, maybe > nimba?) Anyhow, this is what I have

RE: Filehandles named with a variable

2002-04-02 Thread Timothy Johnson
You REALLY shouldn't use $1 for a variable name, though, since it has a special meaning. -Original Message- From: David Gray [mailto:[EMAIL PROTECTED]] Sent: Tuesday, April 02, 2002 2:33 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: Filehandles named with a variable > So, I'

RE: Filehandles named with a variable

2002-04-02 Thread David Gray
> So, I'm trying to 'open ($1,">>$file")', where $1 is a string > like "cbQosCMPrePolicyPktOverflow". > > Obviously, with use strict this does not work. How can I make > it work? I need arbitrarily named filehandles. I know, it > could get rended with gobbleworts if the data gets out of hand..

Filehandles named with a variable

2002-04-02 Thread Mr Hash
So, I'm trying to 'open ($1,">>$file")', where $1 is a string like "cbQosCMPrePolicyPktOverflow". Obviously, with use strict this does not work. How can I make it work? I need arbitrarily named filehandles. I know, it could get rended with gobbleworts if the data gets out of hand... TIA for any

RE: Creating variables of a string

2002-04-02 Thread Nikola Janceski
Forgot about leading whitespace... Assuming we don't do that... there really is no diff. Thanx for clearing that up, but I still think it's confusing. >From the perlfunc pages: As a special case, specifying a PATTERN of space (' ') will split on white space just as split with no arguments does.

Re: simple assignment

2002-04-02 Thread John W. Krahn
Roy Peters wrote: > > I have a string of the following > > $str = "X1=1,Y1=2,Z1=3"; > > I want to assign the values to the right hand side of the "=" to 3 new > variables so the final result is > > $a=1 > $b=2 > $c=3 > > How do I get those values assigned to $a, $b, $c $ perl -le' $str = "X1

Re: simple assignment

2002-04-02 Thread Craig Sharp
Roy, I am a beginner and this code is kludgy but it works. I am sure there are other more simple ways to do this. #!/usr/bin/perl -w $str="X1=1,Y1=2,Z1=3"; ($X1A,$Y1A,$Z1A) = split (/,/, $str); $a = (split (/=/,$X1A))[1]; $b = (split (/=/,$Y1A))[1]; $c = (split (/=/,$Z1A))[1]; print "$a\n"

Re: Creating variables of a string

2002-04-02 Thread John W. Krahn
Nikola Janceski wrote: > > That always confused me, by default split splits by /\s+/ so why confuse us > more by making " " and ' ' magical. No, the default is NOT /\s+/, the following are all equivalent: @words = split; @words = split ' '; @words = split ' ', $_; John -- use Perl; program f

RE: simple assignment

2002-04-02 Thread Nikola Janceski
try this: my($a, $b, $c) = $str =~ /\=(\d+)\,?/g; Nikola Janceski Science without religion is lame, religion without science is blind. -- Albert Einstein (1879-1955) > -Original Message- > From: Roy Peters [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, April 02, 2002 3:43 PM > To: [EMAI

Re: simple assignment

2002-04-02 Thread Chas Owens
On Tue, 2002-04-02 at 15:42, Roy Peters wrote: > gurus, > > OK, shoot me for asking a dumb question. > > I have a string of the following > > $str = "X1=1,Y1=2,Z1=3"; > > I want to assign the values to the right hand side of the "=" to 3 new > variables so the final result is > > $a=1 > $b=

simple assignment

2002-04-02 Thread Roy Peters
gurus, OK, shoot me for asking a dumb question. I have a string of the following $str = "X1=1,Y1=2,Z1=3"; I want to assign the values to the right hand side of the "=" to 3 new variables so the final result is $a=1 $b=2 $c=3 How do I get those values assigned to $a, $b, $c Thanks =

RE: Creating variables of a string

2002-04-02 Thread Nikola Janceski
That always confused me, by default split splits by /\s+/ so why confuse us more by making " " and ' ' magical. Nikola Janceski Oh Joy! My first material possession! I can hardly wait to try it out! -- Stimpy (Ren and Stimpy) > -Original Message- > From: Jeff 'japhy' Pinyan [mailto

HTML whine

2002-04-02 Thread drieux
On Tuesday, April 2, 2002, at 11:47 , Brent Michalski wrote: [..] > while ( my($first, @full_list)=$list_tbl->fetchrow){ > print ""$first; > } technically I LIKE the answer, but PLEASE close it!!! print "" . $first . "" ; the more of these that we get in the habit of making kosher

RE: Creating variables of a string

2002-04-02 Thread Jeff 'japhy' Pinyan
On Apr 2, Timothy Johnson said: >So if you wanted to split on just one space, would split / /,$variable be >treated as magical as well? No. As the split() documentation ALSO states, only split(' ') and split(" ") are treated magically. split(/ /) splits on a single space; the others split as i

RE: Creating variables of a string

2002-04-02 Thread Timothy Johnson
So if you wanted to split on just one space, would split / /,$variable be treated as magical as well? -Original Message- From: Jeff 'japhy' Pinyan [mailto:[EMAIL PROTECTED]] Sent: Tuesday, April 02, 2002 11:50 AM To: David Gray Cc: [EMAIL PROTECTED] Subject: RE: Creating variables of a s

Re: perl / database question

2002-04-02 Thread Brent Michalski
Just quicky, this is what I see. 1) Use the DBI module and the DBD::Pg driver. DBI is very well documented. I've written several articles that use it, it is covered in my book Writing CGI Applications with Perl (Kevin Meltzer wrote this with me also). 2) Biggest problem: while ( my($first, @

RE: Creating variables of a string

2002-04-02 Thread Jeff 'japhy' Pinyan
On Apr 2, David Gray said: >> Michael Stearman wrote: >> >> my ($target, $count, $num) = split ' ', $word; > >I think that needs to be: > >my ($target,$count,$num) = split /\s+/, $word; > >to handle multiple spaces between the values. No. As the split() documentation states, split(' ') is magic

RE: Creating variables of a string

2002-04-02 Thread David Gray
> Michael Stearman wrote: > > > > Right now it is not working and I was wondering if I sent the code > > maybe someone with more experience with this will see the > problem. I > > am very new to this. The line I am trying to create the variables > > from is > > > > C6xxxSimulator(TI)

Re: Creating variables of a string

2002-04-02 Thread John W. Krahn
[Please don't top-post] Michael Stearman wrote: > > Right now it is not working and I was wondering if I sent the code maybe > someone with more experience with this will see the problem. I am very new > to this. The line I am trying to create the variables from is > > C6xxxSimulator(TI)

RE: regex help

2002-04-02 Thread Jason Larson
> -Original Message- > From: Gabby Dizon [mailto:[EMAIL PROTECTED]] > Subject: regex help > > hello list friends, Hello. > > hope you can help me with my problem. here it is: > > i have a date string formatted this way: $date = "Apr. 02, 2002" > i want to capture the "Apr" (without th

RE: Better "tail -f"

2002-04-02 Thread Bruno Figueira
Thank you drieux. The suggestion from your link handles it (I've made minor modifications)! You're right. Checking sizes is a good idea. Ciao, BrunoF -Original Message- From: drieux [mailto:[EMAIL PROTECTED]] Sent: Terça-feira, 2 de Abril de 2002 13:11 To: [EMAIL PROTECTED] Subject:

Re: matching a [ in a regex

2002-04-02 Thread drieux
On Tuesday, April 2, 2002, at 10:13 , Jenda Krynicky wrote: [..] > Either > > $t = "target\\["; > if($line =~ /$t/){ if '$t' was going to be a qr why not: $t = qr/target\[/; i thought the qr was suppose to simplify the compile and rentime time? that way in 'arbitrary time' when one

RE: Creating variables of a string

2002-04-02 Thread Jason Larson
> -Original Message- > From: Michael Stearman [mailto:[EMAIL PROTECTED]] > Subject: Re: Creating variables of a string > > Right now it is not working and I was wondering if I sent the > code maybe > someone with more experience with this will see the problem. > I am very new > to th

FW: Time arithmetics...

2002-04-02 Thread Richard Smith
This is a problem for us historians. I would hope that perl designers, among others, are thinking about wide date ranges... Thanx, Smiddy ( About that log message from AD 61, ... ) -Original Message- From: Michael Kelly [SMTP:[EMAIL PROTECTED]] Sent: Tuesday, April 02, 2002 11:42 AM

Re: matching a [ in a regex

2002-04-02 Thread bob ackerman
On Tuesday, April 2, 2002, at 09:58 AM, Timothy Johnson wrote: > $line = "my target[ target ]"; > > $t = "target["; > if($line =~ /$t/){ > print "yes"; > } try: $t = 'target\['; with single quotes so no interpolation when setting $t.

Re: perl / database question

2002-04-02 Thread Elaine -HFB- Ashton
Johnson, Shaunn [[EMAIL PROTECTED]] quoth: *>Yes I am very new at this ... I was hoping I *>could learn from some examples floating *>around ... but I'm not sure where my results *>should merge with the code (successfully). *> *>The 'while' statement: I want to say 'while *>reading from this list

Re: matching a [ in a regex

2002-04-02 Thread Jenda Krynicky
From: "Timothy Johnson" <[EMAIL PROTECTED]> > When I try to do a pattern match on a variable that contains a '[', I > get the following error: > > Unmatched [ before HERE mark in regex m/target[ << HERE / at > C:\PerlScripts\test.pl line 5. > > Here is my code so far: > > $li

Re: perl / database question

2002-04-02 Thread Agustin Rivera
Unless someone can point out why it wouldn't be better, but try using the PG module. It's an easier to use module for Postgres and it makes it's queries via the DBI. Agustin Rivera Webmaster, Pollstar.com http://www.pollstar.com - Original Message - From: "Johnson, Shaunn" <[EMAIL PRO

matching a [ in a regex

2002-04-02 Thread Timothy Johnson
When I try to do a pattern match on a variable that contains a '[', I get the following error: Unmatched [ before HERE mark in regex m/target[ << HERE / at C:\PerlScripts\test.pl line 5. Here is my code so far: $line = "my target[ target ]"; $t = "target["; if($line =~ /$t/){ print "y

Re: Remove a character from a string

2002-04-02 Thread Jeff 'japhy' Pinyan
On Apr 2, Vitor Carlos Flausino said: >is there any *smart* of puting all characters in lowrecase and at the >same time remove the characters I want... > > >if ($line=~ /^.+: SMTP-Accept:.+:(.+):(\d+):\d+:(.+)$/) { > ($sender=$1)=~tr/A-Z/a-z/; > $sender=~tr/>/d;

Re: Remove a character from a string

2002-04-02 Thread Jeff 'japhy' Pinyan
On Apr 2, Vitor Carlos Flausino said: >I'm trying ro remove the charactes '<' and '>' a string. How do I do it? > >$sender=~tr/ at the same time: tr/<>//d; -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ ht

Remove a character from a string

2002-04-02 Thread Vitor Carlos Flausino
Hi! I'm trying ro remove the charactes '<' and '>' a string. How do I do it? what is wrong with... $sender=~tr//d; ... in one step Thkx, -vcf -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Creating variables of a string

2002-04-02 Thread Jeff 'japhy' Pinyan
On Apr 2, Michael Stearman said: >Michael 57 3 > >I want to assign each of these three to different variables. My only >problem is that the word and the numbers are always different and the space >between the words and numbers is always different as well. Does anyone know >how I would

perl / database question

2002-04-02 Thread Johnson, Shaunn
Howdy: Running Postgres 7.1.3 on RedHat Linux 2.4.7 and Perl 5.6.1. My goal is this: I am trying to put a perl / cgi script together to display a list of tables I pull back from Postgres. I would like to put the table in a scrolling menu form page. So far I have this: [snip code] #!/usr/bi

RE: Time arithmetics...

2002-04-02 Thread Timothy Johnson
What I want to know is how Methuselah managed to be logged on for so long... -Original Message- From: Nikola Janceski [mailto:[EMAIL PROTECTED]] Sent: Tuesday, April 02, 2002 8:47 AM To: 'Michael Kelly'; [EMAIL PROTECTED] Subject: RE: Time arithmetics... I'd like to know when Moses log

RE: Creating variables of a string

2002-04-02 Thread Timothy Johnson
Try this: $word = ; #Assign the next line to the $word variable chomp $word; print "$word\n"; $word =~ /^\s*(\S+)\s+(\S+)\s+(\S+)\s*$/; #assign the matches in parenthesis to $# vars my $target = $1; my $count = $2; my $num = $3; print "Target = $targe

Re: Creating variables of a string

2002-04-02 Thread Michael Stearman
Right now it is not working and I was wondering if I sent the code maybe someone with more experience with this will see the problem. I am very new to this. The line I am trying to create the variables from is C6xxxSimulator(TI) 61 1 and the code is $word = ; #Assign the next line

Re: Creating variables of a string

2002-04-02 Thread Tanton Gibbs
Actually, since the others are numbers you could replace the last two \S+ with \d+ - Original Message - From: "Tanton Gibbs" <[EMAIL PROTECTED]> To: "Michael Stearman" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Tuesday, April 02, 2002 12:06 PM Subject: Re: Creating variables of a strin

Re: Creating variables of a string

2002-04-02 Thread Tanton Gibbs
my ($word, $num1, $num2) = $string =~ /^\s*(\S+)\s+(\S+)\s+(\S+)\s*$/; This matches ^ - the start of the string \s* - any number (including 0) of spaces (\S+) - any number (not including 0) of NON spaces. It also saves the value \s+ - any number (not including 0) of spaces (\S+) - see above \s+

Creating variables of a string

2002-04-02 Thread Michael Stearman
Hi, I have a string that contains a word and 2 numbers. For example, Michael 57 3 I want to assign each of these three to different variables. My only problem is that the word and the numbers are always different and the space between the words and numbers is always different as well

RE: Time arithmetics...

2002-04-02 Thread Nikola Janceski
I'd like to know when Moses logged on. And if you have older logs, who logged on first: the chicken, or the egg? > -Original Message- > From: Michael Kelly [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, April 02, 2002 11:42 AM > To: [EMAIL PROTECTED] > Subject: Re: Time arithmetics... > >

Re: Time arithmetics...

2002-04-02 Thread Michael Kelly
On 4/2/02 1:54 AM, Jonathan E. Paton <[EMAIL PROTECTED]> wrote: >> for instance between feb 28, 200 and >> jan 30, 2002... > > You must be a historian of some sort, nobody > else is interested in such large 'stages' of > time ;-) The question is, what are you doing with log files from the year

RE: PerlMongers Really Are Like Seth!

2002-04-02 Thread Chas Owens
JWZ's Law of Software Envelopment: ``Every program attempts to expand until it can read mail. Those programs which cannot so expand are replaced by ones which can.'' Right now I am thinking of making my production code read emails to determine whether they should be up or down. Yes, I am going

RE: PerlMongers Really Are Like Seth!

2002-04-02 Thread Nikola Janceski
you should have only 2 (at most). Anymore and the time for the project will grow logarithmically, and can extend beyond lifetimes. > -Original Message- > From: drieux [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, April 02, 2002 10:55 AM > To: [EMAIL PROTECTED] > Subject: PerlMongers Really

PerlMongers Really Are Like Seth!

2002-04-02 Thread drieux
On Tuesday, April 2, 2002, at 06:45 , Chas Owens wrote: > On Mon, 2002-04-01 at 17:24, Jonathan E. Paton wrote: [..] > I hope that you meant these foreachs to be one line (each) and your > email client wrapped it. If not, then I fear for the sanity of the next > guy to maintain your code even mo

RE: Better "tail -f"

2002-04-02 Thread Nikola Janceski
preceed it with this then: do{ sleep 1; } while (not -e $filename); of course... you want a more robust tail.. that will require lots of thought... I don't have enough to spare for this though. I have thought about this problem before and said, "screw it, let the user do it." ;)

OOOPSIE on tail -f

2002-04-02 Thread drieux
it is a size thing. if tail opened filename 'file' at size N then process p2 truncates it with p2 > file tail -f file has no output till file is > N it's not an inode thing... ciao drieux --- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional c

Re: Better "tail -f"

2002-04-02 Thread drieux
On Tuesday, April 2, 2002, at 07:04 , Nikola Janceski wrote: > open(TAIL, "tail -f $filename |") or die "no tail $! $?\n"; > while(){ print $_; > } > close TAIL; first off it doesn't seem to work - it is just siting there. The problem being that 'tail' is looking at the old inode

Re: Better "tail -f"

2002-04-02 Thread drieux
On Tuesday, April 2, 2002, at 04:30 , Bruno Figueira wrote: > However, if another program removes (all) lines from the file referenced > by > FH, perl looses the trailing (for a undetermined time). How do I improve > this code to understand the file was changed? I misread your problem - then r

RE: Better "tail -f"

2002-04-02 Thread Nikola Janceski
what about? open(TAIL, "tail -f $filename |") or die "no tail $! $?\n"; while(){ } close TAIL; > -Original Message- > From: Bruno Figueira [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, April 02, 2002 9:53 AM > To: [EMAIL PROTECTED] > Cc: [EMAIL PROTECTED] > Subject: RE: Better "ta

Re: Better "tail -f"

2002-04-02 Thread Chas Owens
On Tue, 2002-04-02 at 09:23, [EMAIL PROTECTED] wrote: > How about putting a file lock on it? > > That way if someone tries to access it and write to it, it will not work. > One problem with doing this is that POSIX does not require programs to check to see if a file is locked before

RE: Better "tail -f"

2002-04-02 Thread Bruno Figueira
Well, I should not lock it. Actually, my code should be "robust" enough to workaround it and "tail -f" a file that is "reseted" sometimes. Cheers, Bruno -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Terça-feira, 2 de Abril de 2002 12:24 To: Figueira, Brun

Re: Style issues (was RE: Increment a Variable)

2002-04-02 Thread Chas Owens
On Mon, 2002-04-01 at 17:24, Jonathan E. Paton wrote: > > For debugging purposes I like to be able > > to see entire functions (and sometimes > > more than one) on the screen at the same > > time. With short loops like this one that > > means keeping it as short and sweet as > > possible to maxim

RE: get file permissions?

2002-04-02 Thread Mark Richmond
Consider sysopen(); saves you the stat(); Use exiting file create if required sysopen(FH, $path, O_WRONLY | O_TRUNC | O_CREAT); If you're really sure it exists sysopen(FH, $path, O_WRONLY | O_TRUNC); > -Original Message- > From: Bryan R Harris [mailto:[EMAIL PROTECTED]] > Sent: M

FQN'ing sub routine names

2002-04-02 Thread drieux
On Tuesday, April 2, 2002, at 04:00 , Orlando Andico wrote: > I detest having > mysterious functions lurking around in my code (e.g. POSIX::ceil instead > of just ceil, Date::Parse::str2time instead of just &str2time) Ok, I'll be silly and ask the Orthodoxy question here Why? What has your

Re: Sort a hash table

2002-04-02 Thread Chris Ball
> "Michael" == Michael Stearman <[EMAIL PROTECTED]> writes: Michael> Does anyone know how to alphabetically sort the keys in a Michael> hash table? Thanks, Hi, Michael. You can find the answer to this question in 'perldoc', under the FAQ section. The command to run would be 'perld

RE: Sort a hash table

2002-04-02 Thread Nikola Janceski
uh... @sortedkeys = sort keys %HASH; remember that you can't keep the keys of %HASH sorted in %HASH, you need an array for that. > -Original Message- > From: Michael Stearman [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, April 02, 2002 9:19 AM > To: [EMAIL PROTECTED] > Subject: Sort a ha

Re: Better "tail -f"

2002-04-02 Thread jbajin
How about putting a file lock on it? That way if someone tries to access it and write to it, it will not work. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Sort a hash table

2002-04-02 Thread Michael Stearman
Hi, Does anyone know how to alphabetically sort the keys in a hash table? Thanks, Mike. _ Join the world’s largest e-mail service with MSN Hotmail. http://www.hotmail.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For addit

RE: Limit floating point numbers?

2002-04-02 Thread David Gray
> > > I have got most everything working ok. Now I need to go back over > > > almost 2500 lines of code and fix my floating point > number so they > > > read 1.25 instead of 1.2556. Which should round out to 1.26 > > > > What text editor are you using? Can you just do a search > and replace?

Re: [ph-perl] regex help

2002-04-02 Thread Orlando Andico
do not reinvent the wheel!! -- # you can get this on CPAN use Date::Parse; use POSIX; # assume your to-be-formatted date is in $date_in my $date_iso8601 = POSIX::strftime ("%Y-%m-%d %H:%M:%S", localtime (Date::Parse::str2time ($date_in))); tada!! the real magic is in str2time: it conve

Better "tail -f"

2002-04-02 Thread Bruno Figueira
Hi there, I have got the example of trailing a file from "Perl Cookbook": --- for (;;) { while () { print $_ } sleep 1; seek(FH, 0, 1); } --- However, if another program removes (all) lines from the file referenced by FH, perl looses the trailing (for a undetermined tim

  1   2   >