reading one character at a time

2002-03-04 Thread richard noel fell
Is there a perl function that reads one character at a time from a string and and returns that character? Something like the following: $Line = some string; foreach ($Line){ $char=read_char($_);} Thanks, Dick Fell -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EM

Re: some questions about for, foreach

2002-03-04 Thread Jon Molin
"John W. Krahn" wrote: > > Jon Molin wrote: > > > > Jan Gruber wrote: > > > > > > Hi, Jon && list ! > > > On Friday 01 March 2002 11:29 am, you wrote: > > > > Hi list! > > > > > > > > I've always thought there's a difference between for and foreach, that > > > > for uses copies and foreach not. B

Re: Running a command Remotely on another Host

2002-03-04 Thread Jon Molin
norishaam wrote: > > Hi, > I've been trying to figure out the above, maybe someone has some > experience...Below is the scenario:- > > 1. I have an executable, update.exe, that can run locally to update the > service pack. > 2. I am trying to write a perl script to have this update.exe t

sendmail

2002-03-04 Thread Rahul Garg
Hello, The problem description is s follows : Well i have made a program that sends mails thru sendmail. earlier the content type was text/html now i have made the content type text/plain acoording to the reqments. but the problem i am getting is in hyperlinks. now i want the hyperlink to be show

Re: reading one character at a time

2002-03-04 Thread Shawn
> Is there a perl function that reads one character at a time from a > string and and returns that character? Something like the following: > $Line = some string; > foreach ($Line){ > $char=read_char($_);} > > Thanks, > Dick Fell I am not positive what you are really wanting here... my $Line = s

Lines count...how to..

2002-03-04 Thread Vitali
Dear friends, can anybody correct me...I have a text file.Data look like this: 10 20 20 20 20 10 20 20 10 20 20 20 and so one - while () { if (substr($_,0,2) eq "10") { #If left 2 characters is 10,then . ++$count; $lines = 0; op

Re: Perl to work like Java

2002-03-04 Thread Jenda Krynicky
From: Michael Kelly <[EMAIL PROTECTED]> > On 3/3/02 6:36 PM, Daniel Falkenberg <[EMAIL PROTECTED]> wrote: > > > Leon, > > > > Yes that is easy enough but can I do this with out the page having > > to have to be refreshed? I would essentially like it to work > > exactly like J

Re: If (/start/ .. /end/) Flip Flop Mechanism

2002-03-04 Thread Steven M. Klass
Hi again, But how does this allow me to say "Search for foo and replace it with bar. if you get to the end without finding foo add this line (which incidentally is the full line including foo and bar) Example File contains foo1 = bar1 foo2 = bar2 foo4 = bar4 search for foo1 and repla

Simple question need ans

2002-03-04 Thread senrong
I am writing a simple program that update and search a text file for names and telephone number I just want to change the number in the text file of a personHow do I do it?

file hashing

2002-03-04 Thread Damir Horvat
Hello! I would like to have my email aliases (stored in a file) hashed over 8 files. In each file the same number of entryes. What's the easyest way of doing it? thanks in advance. Regards, Damir -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: Simple question need ans

2002-03-04 Thread Hanson, Robert
As usual there are many ways to do it. I haven't done much with opening files for read and write at the same time, so someone else will have to provide ideas for that. I would either read in the whole file, then rewrite the whole file... or use DBI (assuming the file is CSV). If you read in the

Can I do this with perl?

2002-03-04 Thread Dave Adams
Hi there, I have a problem which I would like to use perl to resolve, however I'm not sure if it is possible to do. I need to scan a file and check some conditions, first if field 9 is duplicated on 1 or more rows, then I need to check field 10 to see which is the greater value and then only pr

Re: Can I do this with perl?

2002-03-04 Thread Jon Molin
Dave Adams wrote: > > Hi there, > > I have a problem which I would like to use perl to resolve, however I'm not > sure if it is possible to do. > > I need to scan a file and check some conditions, first if field 9 is > duplicated on 1 or more rows, then I need to check field 10 to see which is

RE: Can I do this with perl?

2002-03-04 Thread Nikola Janceski
Yes you can do it with perl, and I suggest using hashes. open(FILE, "$file"); my %seen; while(){ my ($item9, $item10) = (split /\|/, $_)[8,9]; if(exists $seen{$item9}){ if($itme10 > $seen{$item9}){ # the new $item10 is larger than the last o

Re: Can I do this with perl?

2002-03-04 Thread Brett W. McCoy
On Mon, 4 Mar 2002, Dave Adams wrote: > I have a problem which I would like to use perl to resolve, however I'm not > sure if it is possible to do. > > I need to scan a file and check some conditions, first if field 9 is > duplicated on 1 or more rows, then I need to check field 10 to see which i

Re: multidimensional hashes

2002-03-04 Thread Adam Turoff
On Sun, Mar 03, 2002 at 06:29:09PM -0800, Randal L. Schwartz wrote: > Initially, you can use DBD::CSV or that > new DBD::-thingy that is more complete, That would be DBD::SQLite. Z. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: Lines count...how to..

2002-03-04 Thread Bob Showalter
> -Original Message- > From: Vitali [mailto:[EMAIL PROTECTED]] > Sent: Monday, March 04, 2002 6:58 AM > To: [EMAIL PROTECTED]; [EMAIL PROTECTED] > Subject: Lines count...how to.. > > > Dear friends, > can anybody correct me...I have a text file.Data look like this: > 10 > 20 > 20 > 20

Re: Running a command Remotely on another Host

2002-03-04 Thread Elaine -HFB- Ashton
norishaam [[EMAIL PROTECTED]] quoth: *>Hi, *> I've been trying to figure out the above, maybe someone has some *>experience...Below is the scenario:- *> *>1. I have an executable, update.exe, that can run locally to update the *>service pack. *>2. I am trying to write a perl script to have th

RE: Simple question need ans

2002-03-04 Thread Bob Showalter
> -Original Message- > From: senrong [mailto:[EMAIL PROTECTED]] > Sent: Monday, March 04, 2002 9:27 AM > To: [EMAIL PROTECTED] > Subject: Simple question need ans > > > I am writing a simple program that update and search a text > file for names and telephone number > > I just want

Re: multidimensional hashes

2002-03-04 Thread Jenda Krynicky
From: Adam Turoff <[EMAIL PROTECTED]> > On Sun, Mar 03, 2002 at 06:29:09PM -0800, Randal L. Schwartz wrote: > > Initially, you can use DBD::CSV or that > new DBD::-thingy that is > more complete, > > That would be DBD::SQLite. Nice thing! :-) I noticed that it's not available from ActiveState

RE: Can I do this with perl?

2002-03-04 Thread Chas Owens
A quick dissection of what is going on here: On Mon, 2002-03-04 at 10:20, Nikola Janceski wrote: > Yes you can do it with perl, and I suggest using hashes. > > open(FILE, "$file"); This opens a file and associates it with FILE; you really should say something like 'or die "Could not open $file:

RE: Running a command Remotely on another Host

2002-03-04 Thread Timothy Johnson
The easiest way to do this on Windows NT/2000/XP systems is to remotely set a task via the scheduler. The quickest way to do this would be to use the Win32::AdminMisc extension available from http://www.roth.net/perl/adminmisc (he also has a ppm repository for installing it), but you can als

Cookie question

2002-03-04 Thread Motherofperls
Hi, I have a javascript program that makes cookies from outside the cgi-bin. I want to access those cookies from a perl file within the cgi-bin. Cookies are a new subject to me and this is the code I've learned so far in making cookies. #!/usr/bin/perl -w # ic_cookies - sample CGI script that u

RE: Cookie question

2002-03-04 Thread Nikola Janceski
You know that cookies are kept on the client side, not the server side. Lamen's Terms (sp?): Cookie information is stored on the visitor's computer (visitor being the person looking at your site), not the computer that serves the web pages (where you do your work). -Original Message- From

Cookie question

2002-03-04 Thread Motherofperls
Can I read cookies, (written from a javascript located outside the cgi-bin), with a perl file located inside the cgi-bin?

RE: reading one character at a time

2002-03-04 Thread Timothy Johnson
I can't check this right now, but I believe you can do it like this: $Line = "some string"; @array = split //,$Line; #split on null foreach(@array){ $char = read_char($_); } -Original Message- From: richard noel fell To: [EMAIL PROTECTED] Sent: 3/3/02 6:28 PM Subject: reading one c

Re: Can I do this with perl?

2002-03-04 Thread Chas Owens
On Mon, 2002-03-04 at 10:32, Brett W. McCoy wrote: > On Mon, 4 Mar 2002, Dave Adams wrote: > > > I have a problem which I would like to use perl to resolve, however I'm not > > sure if it is possible to do. > > > > I need to scan a file and check some conditions, first if field 9 is > > duplicate

beginners java group?

2002-03-04 Thread Matthew Peter Lyon
Before I Google-Search: I was wondering if anyone subscribed to this list knows of a *good* similar list for java? -mL -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Using strict and getting return values

2002-03-04 Thread Dermot Paikkos
Hi Gurus, I am trying to get tidy with my scripts and want to use Strict but am having difficulty with return values from subroutines. I have the following snippet: while (defined(my $i =<$fh>)) { chomp($i); my @a = split(/|/,$i); my $last = $a[1]; my $first = $a[0]; if (

string indexing

2002-03-04 Thread bob ackerman
I am used to indexing a string in other languages, so i would like to say $x="abcd"; print $x[3]; and see 'd' printed, but, of course, this isn't correct in perl. so i did @y=split(//,"abcd"); print $y[2],"\n"; and that's fine. now, how do i do that without an intermediate array. i want to say

Re: string indexing

2002-03-04 Thread bob ackerman
of course i do suppose the easiest way in perl is to say: print substr("abcd",2,1),"\n"; i guess that is good enough. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: string indexing

2002-03-04 Thread Nikola Janceski
This should work: print ( (split(//,"abcd"))[1] ,"\n"); -Original Message- From: bob ackerman [mailto:[EMAIL PROTECTED]] Sent: Monday, March 04, 2002 12:13 PM To: [EMAIL PROTECTED] Subject: string indexing I am used to indexing a string in other languages, so i would like to say $x="ab

RE: string indexing

2002-03-04 Thread Wagner-David
You can use substr($x,2,1) which would get the third character. You can use a variable for the position and for the number of characters. Wags ;) -Original Message- From: bob ackerman [mailto:[EMAIL PROTECTED]] Sent: Monday, March 04, 2002 09:13 To: [EMAIL PROTECTED] Subject: st

RE: string indexing

2002-03-04 Thread Stout, Joel R
#!/usr/bin/perl -w my $x = "abcd"; print substr($x,3,1); from perldoc perlfunc: substr EXPR,OFFSET,LENGTH,REPLACEMENT substr EXPR,OFFSET,LENGTH substr EXPR,OFFSET Extracts a substring out of EXPR and returns it. First character is at offset `0', or whatever you've set `$['

Comparing to many possibles

2002-03-04 Thread Dennis G. Wicks
Greetings; Is there some perl shorthand that will make it easier to say if ( $x eq 'X' || $x eq 'Y' || $x eq 'Z' ) TIA, Dennis -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: Comparing to many possibles

2002-03-04 Thread Nikola Janceski
if ( $x =~ /^(X|Y|Z)$/ ) # anyone got better? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Monday, March 04, 2002 2:34 PM To: [EMAIL PROTECTED] Subject: Comparing to many possibles Greetings; Is there some perl shorthand that will make it easier to say

RE: Comparing to many possibles

2002-03-04 Thread Wagner-David
Could use a regex: if ( $x =~ /[XYZ]/ ) { # if contains }else # if doesn't contain } If there can be more than one character (like ' ABX') then you would need to add: $x =~ /^

RE: Using strict and getting return values

2002-03-04 Thread Jason Larson
> -Original Message- > From: Dermot Paikkos [mailto:[EMAIL PROTECTED]] > Subject: Using strict and getting return values > > Hi Gurus, Well, I'm definitely not a guru, but I think I might be able to help... :) > > I am trying to get tidy with my scripts and want to use Strict but am >

Re: Using strict and getting return values

2002-03-04 Thread Jonathan E. Paton
--- Dermot Paikkos <[EMAIL PROTECTED]> wrote: > Hi Gurus, > > I am trying to get tidy with my scripts and want to > use Strict Use lowercase for strict! Anything else will cause havoc. > but am having difficulty with return values from > subroutines. I have the following snippet: > > whi

RE: Comparing to many possibles

2002-03-04 Thread Timothy Johnson
You can do it with a regex: if($x =~ /^[XYZ]$/){ do something... } or if($x =~ /^(X|Y|Z)$/){ do something... } -Original Message- From: Dennis G. Wicks [mailto:[EMAIL PROTECTED]] Sent: Monday, March 04, 2002 11:34 AM To: [EMAIL PROTECTED] Subject: Comparing to many possibles

Re: string indexing

2002-03-04 Thread bob ackerman
ah. thank you. i needed the extra set of parens for the print statement. although i thought print (split //,"abcd")[1],"\n"; or print ((split //,"abcd")[1]),"\n"; should work, i guess the first paren is assigned to 'print' and sees the right paren as ending the 'print' statement. seems oddish.

RE: Comparing to many possibles

2002-03-04 Thread Jason Larson
> -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] > Subject: Comparing to many possibles > > Greetings; > > Is there some perl shorthand that will make it easier to say > > if ( $x eq 'X' || $x eq 'Y' || $x eq 'Z' ) > This should do what you want: if

Re: Comparing to many possibles

2002-03-04 Thread bob ackerman
$x='y'; if($x=~/[xyz]/) # checks for match to any character in set { print 'yes'; } else { print 'no'; } On Monday, March 4, 2002, at 11:33 AM, Dennis G. Wicks wrote: > Greetings; > > Is there some perl shorthand that will make it easier to say > > if ( $x eq 'X' || $x

Re: Can I do this with perl?

2002-03-04 Thread Jenda Krynicky
From: Chas Owens <[EMAIL PROTECTED]> > On Mon, 2002-03-04 at 10:32, Brett W. McCoy wrote: > > On Mon, 4 Mar 2002, Dave Adams wrote: > > > > > I have a problem which I would like to use perl to resolve, > > > however I'm not sure if it is possible to do. > > > > > > I need to scan a file and check

RE: reading one character at a time

2002-03-04 Thread Jonathan E. Paton
> Is there a perl function that reads one character at > a time from a string and and returns that character? There are VERY FEW situations that require this kind of action... but assuming you have one then the well proven shortest approach is: $string = "Hello World"; @string = $string =~ /./g;

RE: string indexing

2002-03-04 Thread Nikola Janceski
actually without parenthesis around the array you are printing, perl gets confused and returns the error: Can't use subscript on print at - line 1, near "1]" W/O the second set of parenthesis, print interperts the first open parenthises for its function call: print ("hello", "how are you"); but

Re[2]: Sockets and NNTP

2002-03-04 Thread Daniel Gardner
Monday, March 04, 2002, 12:28:44 AM, Hernan Freschi wrote: > I already did, but I dont understand it,... it uses objects and I don't know > them. i just took a look, and it seems to send a \015\012 i was assuming when you said \r\f below it was a typo and you meant \r\n, if that's not the case

RE: reading one character at a time

2002-03-04 Thread Nikola Janceski
actually searching on a empty pattern is wrong wrong wrong! a pattern in a search that evalutes to "" will use the previous successful pattern match. so the following: if($x =~ /pattern/){ print "yes\n" if($y =~ //); ## this really means if($y =~ /pattern/) if you made it this far

how to start writing perl and system setup

2002-03-04 Thread Venkat Kaza
Hi, I did download perl (stable.zip) from perl.com and I don't know how to setup that so that I can start writing some perl and later some CGI scripts too. I have windows Xp. I did download this file and unzipped it . If some one can help me out with this task it would be of great help. Thank

RE: how to start writing perl and system setup

2002-03-04 Thread Timothy Johnson
For windows xp, the best way to install perl is to check out ActiveState's ActivePerl. Go to http://www.activestate.com/Products/ActivePerl/. You can download a Windows Installer file that will set up the file associations, etc. automatically. -Original Message- From: Venkat Kaza [mail

How to insert a line in the middle of a file?

2002-03-04 Thread Kypa, J. (Jagan)
Hi, I am modifying an existing perl script to basically insert a statement as the 3rd sentence of a file(so the existing 3rd sentence of the file would become the 4th sentence). I've looked at some FAQs on the perldoc.com site and managed to get started. However, I am only able to insert t

RE: reading one character at a time

2002-03-04 Thread Timothy Johnson
I don't think that applies to split(), however. In this case it works works works! :) -Original Message- From: Nikola Janceski [mailto:[EMAIL PROTECTED]] Sent: Monday, March 04, 2002 10:55 AM To: 'Jonathan E. Paton'; [EMAIL PROTECTED] Subject: RE: reading one character at a time actua

RE: reading one character at a time

2002-03-04 Thread Jonathan E. Paton
--- Nikola Janceski <[EMAIL PROTECTED]> wrote: > actually searching on a empty pattern is wrong wrong > wrong! A pattern in a search that evalutes to "" will > use the previous successful pattern match. Lets see what I actually said: | Split on a null length string is probably more | readable,

Re: How to insert a line in the middle of a file?

2002-03-04 Thread Eric Beaudoin
At 14:11 2002.03.04, Kypa, J. (Jagan) wrote: >$old = "$LeafPreName.acf"; >$new = "$old".".tmp"; >$bak = "$old".".orig"; > >open(OLD, "<$old"); >open(NEW, ">$new"); > >while (<>) { > if ($. == 3) { > print NEW "INTEGRATOR/ ERROR=5.0E-2, HINIT=2.5E-4,HMAX=2.5E-4, >KMAX=6, MAXIT=10\n"; >

send email and upload file

2002-03-04 Thread Debbie McNerney
Hello My apologies to everyone but this list does say 'beginners'. My problem...I am trying to modify a script that a co-worker wrote for us. He no longer works here. The snippets of the script below #!/usr/bin/perl BEGIN { $email_addresses = "blah\@blah.com, blahblah\blah.com,etc";

Re: send email and upload file

2002-03-04 Thread Robert Aspinall
In the HTML that refers to this perl script, you're going to need to add this to the form section: Then, in the perl script, you'll need to have $email_addresses equal the input passed by that form. There should be a section of the perl script that deals with HTTP GET or POST data - that's the s

Re: send email and upload file

2002-03-04 Thread Jonathan E. Paton
> My apologies to everyone but this list does say 'beginners'. Indeed it does, though some of us have lost our beginner status :) > My problem...I am trying to modify a script that a co-worker > wrote for us. He no longer works here. Typical The snippets of the script below > #!/usr/bin/pe

Re: How to insert a line in the middle of a file?

2002-03-04 Thread Kypa, J. (Jagan)
Eric, Thank you. Works like a charm. Thanks again. I have the loop as while () { if ($. == 3) { print NEW "INTEGRATOR/ ERROR=5.0E-2, HINIT=2.5E-4,HMAX=2.5E-4, KMAX=6, MAXIT=10\n"; } print NEW; } Regards, Jagan Eric Beaudoin wrote: > > At 14:11 20

Re: string indexing

2002-03-04 Thread John W. Krahn
Bob Ackerman wrote: > > I am used to indexing a string in other languages, so i would like to say > $x="abcd"; > print $x[3]; > and see 'd' printed, but, of course, this isn't correct in perl. > > so i did > @y=split(//,"abcd"); > print $y[2],"\n"; > > and that's fine. > > now, how do i do tha

urgent redundancy question

2002-03-04 Thread M z
Hi I'm trying to remove to analyze two successive lines in a row and remove one of them if they say the same thing, like so...based on different beginning charactes sample input: B water C water if so, then only keep B water and discard C water I tried doing so with this snippet, but it wasn'

RE: urgent redundancy question

2002-03-04 Thread Wagner-David
Here is one approach. Used __DATA__ to hold data for testing. Use dchomp to remove end of line. #!perl -w while() { chomp; next if ( /^\s*$/ ); # if blank line bypass if ( /^B/ ) { $b = $_; chomp($c = ); if ( $c !~ /^C/ ) { printf "Expe

Re: string indexing

2002-03-04 Thread bob ackerman
now that is clever! what is the literal meaning/function of the '+'. of course, one still must know that a leading paren will be seen by 'print' unless there is some intervening dummy character. that's ok. On Monday, March 4, 2002, at 12:15 PM, John W. Krahn wrote: > print +(split //, "abcd")

Anyone familiar with Perl for Netware

2002-03-04 Thread Louden, Chris
Hello, just joined the group looking for some help with Perl. I used to have an NT box running Perl from Active State, it died in a most gruesome way. Now I have a Novell 5.1 Server. Trying to reconfigure some of the scripts to run in the Novell environment. On NT I had a script that ran on the

Re: Comparing to many possibles

2002-03-04 Thread Jeff 'japhy' Pinyan
On Mar 4, Dennis G. Wicks said: >Is there some perl shorthand that will make it easier to say > > if ( $x eq 'X' || $x eq 'Y' || $x eq 'Z' ) You can use if ($x =~ /^(?:X|Y|Z)\z/) { ... } I side with Randal in warning about the use of $ here where \z is clearly the proper choice. -- J

Re: Comparing to many possibles

2002-03-04 Thread William.Ampeh
I prefer this $x =~ /^[x-z]$/i; Normally, I will use: my $ans = ( $x =~ /^[x-z]$/i )?"yes":"no"; print "\n\nThe answer = $ans\n"; __ William Ampeh (x3939) Federal Reserve Board -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: reading one character at a time

2002-03-04 Thread Jason Larson
> -Original Message- > From: Timothy Johnson [mailto:[EMAIL PROTECTED]] > Subject: RE: reading one character at a time > > I can't check this right now, but I believe you can do it like this: > > $Line = "some string"; > @array = split //,$Line; #split on null > foreach(@array){ >$c

RE: Comparing to many possibles

2002-03-04 Thread Timothy Johnson
I still am not convinced that all of the hoopla about \z is really necessary. I guess the question I need answered before I go back and change anything is this: How is the user supposed to enter an extra \n without exiting the prompt? What I mean is, the only situation in which this could ma

Re: sendmail

2002-03-04 Thread Johannes Franken
On Mon, Mar 04, 2002 at 03:22:12PM +0530, Rahul Garg wrote: > now i want the hyperlink to be shown as http://www.abc.com > and the actual path to be http://www.abc.com/xyz/abc.htm > How can i achieve this? There's only way to achieve this: Have the abc.com's webmaster redirect his index page t

RE: Comparing to many possibles

2002-03-04 Thread Jeff 'japhy' Pinyan
On Mar 4, Timothy Johnson said: > I still am not convinced that all of the hoopla about \z is really >necessary. I guess the question I need answered before I go back and change >anything is this: How is the user supposed to enter an extra \n without >exiting the prompt? What I mean is, the o

Re: sendmail

2002-03-04 Thread Robert Aspinall
Not entirely sure what Rahul Garg was trying to do, but a simple http://www.abc.com/xyz/abc.htm>http://www.abc.com inserted into the HTML code would produce the desired result. You're right though, it's totally off topic :) Robert Aspinall V-ONE Corporation [EMAIL PROTECTED] - Original Mess

RE: Comparing to many possibles

2002-03-04 Thread Timothy Johnson
Okay, that makes a little more sense. -Original Message- From: Jeff 'japhy' Pinyan [mailto:[EMAIL PROTECTED]] Sent: Monday, March 04, 2002 1:31 PM To: Timothy Johnson Cc: [EMAIL PROTECTED] Subject: RE: Comparing to many possibles On Mar 4, Timothy Johnson said: > I still am not convi

Re: Comparing to many possibles

2002-03-04 Thread Dennis G. Wicks
Greetings All; Thanks for all the great suggestions! They all worked as written and now I can go onto the next problem. What ever that turns out to be! And to answer a couple of questions; >}On Mar 4, 12:36, Luke Bakken wrote: >} Subject: Re: Comparing to many possibles >Why do you need shortha

connecting to mysql database ?

2002-03-04 Thread Brian Volk
Hi All, I'm having some trouble connecting to mysql database. Here is a copy of the script I'm using... One of the errors I'm getting is "no database driver specified". Any help would be greatly appreciated. Thanks! Brian [EMAIL PROTECTED] #!/usr/bin/perl use DBI; # Gather some inform

Re: connecting to mysql database ?

2002-03-04 Thread bob ackerman
don't know if this is it, but i am using" $dbh = DBI->connect("DBI:mysql:$db_name") or die "Cannot connect to database". DBI->errstr; note that is 'DBI:mysql', not 'DBD:mysql'. On Monday, March 4, 2002, at 02:37 PM, Brian Volk wrote: > Hi All, > > I'm having some trouble connec

Simple question

2002-03-04 Thread suraj rajendran
Hi, How do I just print only the City and State where person lives assuming that I have the following data. Thanks __DATA__ Tomy Savage:408-724-0140:1222 Oxbow Court, Sunnyvale,CA 94087:5/19/66:34200 Lesle Kerstin:408-456-1234:4 Harvard Square, Boston, MA 02133:4/22/62:52600 JonDeLoach:408-253-

replacing last 4 digits

2002-03-04 Thread Sethi, Pradeep
Hi, I have a number 342389842452. how do a substitute of everything with X but last 4 digits using regular expressions like 2452 Thanks Prad -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Re[2]: Sockets and NNTP

2002-03-04 Thread Hernan Freschi
well... just because I wanted to do it myself :) (laziness?... i'm not a good programer then ;). never mind, i'm now using NNTPClient.pm, thanks anyway. "Daniel Gardner" <[EMAIL PROTECTED]> escribió en el mensaje news:[EMAIL PROTECTED].; > Monday, March 04, 2002, 12:28:44 AM, Hernan Freschi wrot

RE: replacing last 4 digits

2002-03-04 Thread Timothy Johnson
If the length of the string stays constant, you can do something like this: $string = 342389842452; $string =~ s/^\d{8}//; #replace the first 8 digits print $string -Original Message- From: Sethi, Pradeep [mailto:[EMAIL PROTECTED]] Sent: Monday, March 04, 2002 3:00 PM To: [EMAIL

Re: replacing last 4 digits

2002-03-04 Thread Jeff 'japhy' Pinyan
On Mar 4, Sethi, Pradeep said: >I have a number 342389842452. > >how do a substitute of everything with X but last 4 digits using regular >expressions > >like 2452 You could take an approach like: s/\d(?=\d{4})/x/g; The (?=...) means "look ahead for ...". So this regex matches a dig

from file to a list containing lists

2002-03-04 Thread James Woods
I've got a file that I would like to import into a list. The file has many rows, and each row has 3 records, seperated with a "|". Example of file is as below: f|Axe Strike|d f|Disquiet of our people|p f|Dwarven Armor|p When I was just using 1 record in the file, @Array = ended up working g

Re: string indexing

2002-03-04 Thread John W. Krahn
Bob Ackerman wrote: > > On Monday, March 4, 2002, at 12:15 PM, John W. Krahn wrote: > > > > print +(split //, "abcd")[1], "\n"; > > now that is clever! what is the literal meaning/function of the '+'. > of course, one still must know that a leading paren will be seen by 'print' > unless there

Re: from file to a list containing lists

2002-03-04 Thread Eric Beaudoin
At 19:03 2002.03.04, James Woods wrote: >I've got a file that I would like to import into a list. The file has many rows, and >each row has 3 records, seperated with a "|". > >Example of file is as below: > >f|Axe Strike|d >f|Disquiet of our people|p >f|Dwarven Armor|p > >When I was just using 1

Re: Simple question

2002-03-04 Thread Jeff 'japhy' Pinyan
On Mar 4, suraj rajendran said: >How do I just print only the City and State where >person lives assuming that I have the following data. It looks like your data is :-delimited. For your purposes, the split() function should do fine: ($name, $phone, $addr, $bday, $n) = split /:/, $record; O

Re: from file to a list containing lists

2002-03-04 Thread Jeff 'japhy' Pinyan
On Mar 4, Eric Beaudoin said: >my @records; >open FILE, "yourfile" or die "Can't open file yourfile:$!"; > >push @records, split /\|/ while(); > >close FILE; You mean push @records, [ split /\|/ ] while ; You want to construct an array reference. >@records = ( [ "f", "Axe Strike", "d" ], >

Re: Simple question

2002-03-04 Thread Jeff 'japhy' Pinyan
On Mar 4, Jeff 'japhy' Pinyan said: >And then you'll want to remove the extraneous information. > > ($city, $state) = $addr =~ /\s*([^,]+),\s*([A-Z]{2})/; I left the first comma out of my regex. ($city, $state) = $addr =~ /,\s*([^,]+),\s*([A-Z]{2})/; >>__DATA__ >>Tomy Savage:408-724-0140:12

Re: replacing last 4 digits

2002-03-04 Thread John W. Krahn
Pradeep Sethi wrote: > > Hi, > > I have a number 342389842452. > > how do a substitute of everything with X but last 4 digits using regular > expressions > > like 2452 $_ = 342389842452; s/\d*(\d{4})/$1/; print; John -- use Perl; program fulfillment -- To unsubscribe, e-

Re: from file to a list containing lists

2002-03-04 Thread Eric Beaudoin
At 19:17 2002.03.04, Jeff 'japhy' Pinyan wrote: >>my @records; >>open FILE, "yourfile" or die "Can't open file your; >> >>push @records, split /\|/ while(); >> >>close FILE; > >You mean > > push @records, [ split /\|/ ] while ; > >You want to construct an array reference. > >>@records = ( [ "f",

RE: urgent redundancy question

2002-03-04 Thread M z
sir, thank you I tried this approach and it is almost perfect, can you help me fix one thing...The problem is I negated cases where is not a following C H20 such as B H20 then its not printed, I don't want that, I wonder if you can modify my script slightly to let those cases be printed. The

Re: from file to a list containing lists

2002-03-04 Thread Jeff 'japhy' Pinyan
On Mar 4, Eric Beaudoin said: >>>@records = ( [ "f", "Axe Strike", "d" ], >>> [ "f", "Disquiet of our people", "p" ], >>> [ "f", "Dwarven Armor", "p" ] ); >> >>Well, except that the last field will have a newline in it! > > push @records, [ split /\|/, chomp($_) ] while

Re: from file to a list containing lists

2002-03-04 Thread James Woods
OK, you're totally right, I should have printed my code 8^( I figured that it would be totally easy... then I remembered that I'm a noobie and everything is confusing 8^) First, let me say that I'm trying to get work to buy me a Perl book, but money at the state is tight these days. I've eve

i have several very easy question ...

2002-03-04 Thread FARSHAD
hi dear experts i'm very beginer in perl .. before this i did know asp and java and java script for client side .. now i want switch to perl language and i have several easy question about that ... 1- my platform is win98 and i want a web server which can be run perl in itself ... 2- please send

Passing question on DMB files with complex stuff

2002-03-04 Thread Frank 'Olorin' Rizzi
So, I love DBM files, because I think they'll work just great for the application I have to develop. So far I worked with simple hashes (key => value) on DBM files, and everything seems fine. However, I now realize I need to complicate matters a bit. Instead of a simple hash, I'll need something

HTML::Tree with https

2002-03-04 Thread Daniel Falkenberg
Hey all, Is it possible to do the following... I want to get the URL at $inputsite with the following... $inputSite = "mydomain.com/cgi-bin/new-userdatalookup?username=$username&access=Dialu p&month=01&year=2001&loggedin=1"; $tree = HTML::TreeBuilder->new; $address = "https://"; . $inputSite; $

HTML::Tree with https --> Make that HTML::Request with https

2002-03-04 Thread Daniel Falkenberg
Hey all, Is it possible to do the following... I want to get the URL at $inputsite with the following... $inputSite = "mydomain.com/cgi-bin/new-userdatalookup?username=$username&access=Dialu p&month=01&year=2001&loggedin=1"; $tree = HTML::TreeBuilder->new; $address = "https://"; . $inputSite; $

RE: replacing last 4 digits

2002-03-04 Thread Sethi, Pradeep
Thank you very much Japhy for this solution now how can I replace digits with formatted Xs like : 123412341234 to --1234 and 0123412341234 to --X1234 using regular expressions. Thanks in Advance Pradeep -Original Message- From: Jeff 'japhy' Pinyan [mailto:[EMAI

Re: reading a file line by line

2002-03-04 Thread Hernan Freschi
There's a simpler way, if you specify the file from the command line (as in script.pl file) you can do while (<>) { last if /search test/; #do something } in fact, you can make a cat-like script like this: while (<>) { print; } <> is the diamond operator, and it's the filehandle fo

Perl and COM

2002-03-04 Thread Ben Nospam
I'm interested in accessing COM from Perl. In particular, we (my employer) have a hardware test application based on COM/ATL, with IO devices being accessed through a COM server. Coming up on my schedule is integrating that test functionality with a scripting language such that test scripts can

painful but bonehead question

2002-03-04 Thread dru levin
I am a newbie trying to write Perl scripts in Linux environment: question is, why is Perl evaluating my " (quotes) as ? (question marks) ? , i.e. like in a simple string " blah blah blah" do I have to be in certain shell if using a Linux-based environment. It works fine on my NT box with basic c