Re: Problem with reading string from commandline

2001-05-03 Thread Jose Vazquez
Greg, I already tried that, it doesn't work. :( When it gets to the ()[] it stops at once, with the error NO MATCH I need to remove the ()[] before it gets read, or ARGV needs somekind of option so it will ignore them. Thanks jose vazquez [EMAIL PROTECTED] On Thu, 3 May 2001, Greg Meckes wr

Re: Problem with reading string from commandline

2001-05-03 Thread Collin Rogowski
I think the problem is not with perl, but with your shell.  For the most shells () and [] are metacharacters (in bash [] is for  pattern matching and () is to fork a process, me thinks).  You either have to put the entire paramline into ''. Than you have  to alter your perl-programm, because you j

Re: Problem with reading string from commandline

2001-05-03 Thread Greg Meckes
Couldn't you just do something simple like: #at your "for" loop for ($t=0;$t<$z;$t++) { #Insert this $zin[$t] =~ s/\[//g; #Remove left bracket $zin[$t] =~ s/\]//g; #Remove right bracket #End insert #And continue with the rest... if ($zin[$t] eq "212.104.202.50") { #etc ### It'll

Problem with reading string from commandline

2001-05-03 Thread jose
Hi, I'm having a problem with a script. This is a bit of a long story, but I hope someone can help me. I've been busy with it now for two weeks, and I still don't know how to get it working perfectly. I'm used to C, and perl is rather new to me. Thanks in advance. I would like to thank Collin

RE: RegEx Prob WAS: Problem with reading string

2001-05-01 Thread J. Patrick Lanigan
I just keep learning. This list is making learning much easier. Thanks to Dan and Jason, Patrick > you need the global modifier .. what you're trying to do is do the current > match globally throughout the whole string (not zero or more) > > $mystring =~ s/\'/\\'/g;

Re: Problem with reading string

2001-05-01 Thread Dan Brown
Use the 'g' switch so the pattern match is $mystring =~ s/\'/\\'/g; This 'g' says do it for all occurrences (I remember it by thinking of it as the 'g' in 'globally'). Dan "J. Patrick Lanigan" wrote: > > I was using: > > $mystring =~ s/\'/\\'/; > > ...to replace ' with \' in

RE: RegEx Prob WAS: Problem with reading string

2001-05-01 Thread King, Jason
J. Patrick Lanigan writes .. >> I was using: >> >> $mystring =~ s/\'/\\'/; >> >> ...to replace ' with \' in $mystring. It was working find I >> thought, until I >> encountered a string with multiple apostrophies. How do I replace >> 0 or more? >> >> Ex: >> >> "No More 'I Love You's'" >

RegEx Prob WAS: Problem with reading string

2001-05-01 Thread J. Patrick Lanigan
Opps, I forgot to change the subject. I think I need to get outside and get some fresh air. > I was using: > > $mystring =~ s/\'/\\'/; > > ...to replace ' with \' in $mystring. It was working find I > thought, until I > encountered a string with multiple apostrophies. How do I replace > 0 or

RE: Problem with reading string

2001-05-01 Thread J. Patrick Lanigan
I was using: $mystring =~ s/\'/\\'/; ...to replace ' with \' in $mystring. It was working find I thought, until I encountered a string with multiple apostrophies. How do I replace 0 or more? Ex: "No More 'I Love You's'" ...should become: "No More \'I Love You\'s\'" I

Re: Problem with reading string

2001-05-01 Thread Greg Meckes
In your statements: print "@zin[$i] \n\r"; You should use: print "$zin[$i] \n\r"; And: > $ta = @zin[6]; > $tb = @zin[7]; > $tc = @zin[8]; > $td = @zin[9]; should be: > $ta = $zin[6]; > $tb = $zin[7]; > $tc = $zin[8]; > $td = $zin[9]; And: if (@zin[$t] = /212.104.202.50/g) { Should be: if ($z

Re: Problem with reading string

2001-05-01 Thread Collin Rogowski
I didn't quite get what your problem was. Can you elaborate on that? There are a couple of newbie problems in your script: > ## > #!/usr/bin/perl You should say: !/usr/bin/perl -w This turns on warnings (which is very helpful

Problem with reading string

2001-05-01 Thread jose
Hi, I have a small problem, I'm trying to do the following. I'm using WOTS to scan logfiles, and when it gets an error from our name server, it has to cut the error message in pieces separated by a space. And has to compare it to the if statements. After that it has to copy a few pieces to mak