Re: Find regex in Start/Stop segments

2003-06-13 Thread Tassilo von Parseval
On Fri, Jun 13, 2003 at 03:09:20PM -0700 R. Joseph Newton wrote: > Tassilo von Parseval wrote: > > > > chomp; > > > > I don't think that the entries in @ARGV contain newlines at the end. > > Actually I know they don't. :-) > > > > That's good. and that is why chomp is an excellent choice for

RE: compare, checking and listing

2003-06-13 Thread Boon Chong Ang
Gupta, This method will only print the elements present in test2 array and not in test1 array but how about the elements in test1 array which aren't match any elements in test2 array? Thank you & best regards, ABC -Original Message- From: Gupta, Sharad [mailto:[EMAIL PROTECTED] Sent:

RE: compare, checking and listing

2003-06-13 Thread Gupta, Sharad
One way: To find out elements which are in test2 and not in test1: #!-*-perl-*- use strict; my @test1 = qw(1 2 3 4); my @test2 = qw(1 2 5 6 7 8); foreach my $element(@test2) { print $element if([EMAIL PROTECTED]); } -Sharad -Original Message- From: Boon Chong Ang [mailto:[EM

Re: Adding user to the system by using Perl?

2003-06-13 Thread Josimar Nunes de Oliveira
I get an error at line: system("/usr/sbin/chpasswd $user:$password")==0 or die "Error: $?"; and I changed it to: system("echo $user:$password | /usr/sbin/chpasswd")==0 or die "Error: $?"; in such way it works fine. Any comment? - Original Message - From: "Janek Schleicher" <[EMA

Re: vs while()

2003-06-13 Thread Bryan Harris
Thanks, Rob. Is there anywhere I can find other special cases? I was so happy when I learned about split ' '. =) Thanks again. - Bryan > Bryan Harris wrote: >> Out of curiosity, why doesn't >> >> ; >> assign a line to $_, but > > Reads a line from the FILE filehandle. Because it is

compare, checking and listing

2003-06-13 Thread Boon Chong Ang
Hi, I have two array, @test1, @test2. Just say, I want compare @test2 with @test1 in such manner. @test2 could contains more, less or equal elements compare to @test1 which I don't know. I want to write a perl script to compare @test2 to @test1 and list out those element within @test2 that is not r

Wanting to send email but have some bold or underlined text in message

2003-06-13 Thread Wagner, David --- Senior Programmer Analyst --- WGO
So used to just sending data and I was wondering if one can send bold or underlined text, etc from straight email message or does it have to be in an attachment? Using w2k on AS Perl build 623 or 635. Thanks. Wags ;) **

RE: Help required.....about string/text manipulation

2003-06-13 Thread Mohit_Jain01
Hi Rob, I have a big file containing about 20 lines. This file basically contains some records. A sample of the file is as given below: dn: cn=1148734,ou=Employees,dc=jci,dc=com displayname: Herek, Moriah L jdirlastfourssn: 2888 dn: cn=1148735,ou=Employees,dc=jci,dc=com displayname: Pell

Re: Help required.....about string/text manipulation

2003-06-13 Thread Rob Dixon
Mohit_jain01 wrote: > Hi, > > I am facing a problem with text file manipulation with Perl. > > I have a file with over 2 lac lines of data. > I need to find the duplicates(strings) in the file and copy those records into > another file. > > Is there a function/module in Perl by which I can read t

Re: Find regex in Start/Stop segments

2003-06-13 Thread R. Joseph Newton
Tassilo von Parseval wrote: > > chomp; > > I don't think that the entries in @ARGV contain newlines at the end. > Actually I know they don't. :-) > That's good. and that is why chomp is an excellent choice for this context. Because the OP may not know, or be sure of, that fact. The chomp func

Help required.....about string/text manipulation

2003-06-13 Thread Mohit_Jain01
Hi, I am facing a problem with text file manipulation with Perl. I have a file with over 2 lac lines of data. I need to find the duplicates(strings) in the file and copy those records into another file. Is there a function/module in Perl by which I can read the duplicates in a file at one

Re: Writing Platform Independant Perl Code

2003-06-13 Thread James Edward Gray II
On Friday, June 13, 2003, at 03:58 PM, perl_beginner wrote: Hey All, Thanks folks for all the pointers, From the replies so far, I see two approaches. I need to work with files/pathnames through portable perl modules. This means I don't have to actually perform any OS-specific work before in

Re: find and replace string

2003-06-13 Thread Paul Johnson
On Fri, Jun 13, 2003 at 10:03:40PM +0100, Rob Dixon wrote: > > basically i wanto get result 13 in $str. > > > > how to do this? > > It depends on what '13' looks like in general in the strings > you're processing. If it's always the first non-space thing > after the start of the line then > >

Re: vs while()

2003-06-13 Thread Rob Dixon
Bryan Harris wrote: > Out of curiosity, why doesn't > > ; > assign a line to $_, but Reads a line from the FILE filehandle. Because it is in 'void' context (the result is unused) it behaves as if it were in scalar context and reads a single line from the file. > > while () {} > > does? T

Re: Writing Platform Independant Perl Code

2003-06-13 Thread perl_beginner
Hello all, > While the code works fine with Linux, crumbles on XP saying "Can't find > string terminator "EOM" anywhere before EOF at recordProxy.pl line 317". > Line 317 in my code is: $response= <<"EOM"; Nevermind, this was just a dos2Unix ASCII issue :S The code works great on Windows...

Re: find and replace string

2003-06-13 Thread Rob Dixon
Hi Madhu. You have two different questions here! Madhu Reddy wrote: > Hi, >I want to find and replace string with particular > pattern > > > my $str = " 13 A.MFDF_FEEDER_ET"; > $str =~ s/\s+//g; > > here i want to replace string that end with "_ET" with > null To replac

vs while()

2003-06-13 Thread Bryan Harris
Out of curiosity, why doesn't ; assign a line to $_, but while () {} does? - B -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Writing Platform Independant Perl Code

2003-06-13 Thread perl_beginner
Hey All, Thanks folks for all the pointers, From the replies so far, I see two approaches. I need to work with files/pathnames through portable perl modules. This means I don't have to actually perform any OS-specific work before installation of the application. As I go through the documen

RE: How to check if a set of numbers are in the correct Sequence.

2003-06-13 Thread Bakken, Luke
Two caveats: If your first number in the file is 0, then it'll die. I'll leave that as an exercise to you to fix. Also, my explanation is incorrect, it should read "or if the current number is less than or equal to the previous". Thanks! > -Original Message- > From: Bakken, Luke > Sent:

Re: How to check if a set of numbers are in the correct Sequence.

2003-06-13 Thread Rob Dixon
James Parsons wrote: > Hi all > > Since I'm new to perl, I'm not sure how to tackle this type of problem > > a. I have file with the following in it > 100 > 101 > 102 > 103 > > b. How would check if these numbers are in correct sequence > c And they are not sequence kick out an error message.

RE: How to check if a set of numbers are in the correct Sequence.

2003-06-13 Thread Bakken, Luke
use strict; my $prev; while (<>) { chomp; die "not a number" unless /^\d+$/; die "out of order" if $_ <= $prev; $prev = $_; } Usage: $ perl numchecker inputfile Let me know if this works OK, it's untested. It should die on a non-integer input, or if the previous

How to check if a set of numbers are in the correct Sequence.

2003-06-13 Thread James Parsons
Hi all Since I'm new to perl, I'm not sure how to tackle this type of problem a. I have file with the following in it 100 101 102 103 b. How would check if these numbers are in correct sequence c And they are not sequence kick out an error message. Any help would be great James P

Re: find and replace string

2003-06-13 Thread James Edward Gray II
On Friday, June 13, 2003, at 03:08 PM, Madhu Reddy wrote: Hi, Howdy. I want to find and replace string with particular pattern my $str = " 13 A.MFDF_FEEDER_ET"; $str =~ s/\s+//g; here i want to replace string that end with "_ET" with null basically i wanto get result 13

find and replace string

2003-06-13 Thread Madhu Reddy
Hi, I want to find and replace string with particular pattern my $str = " 13 A.MFDF_FEEDER_ET"; $str =~ s/\s+//g; here i want to replace string that end with "_ET" with null basically i wanto get result 13 in $str. how to do this? I really appreciate u r help Thanks

Re: Html::mason

2003-06-13 Thread Casey West
It was Friday, June 13, 2003 when Paul Kraus took the soap box, saying: : I am trying to get mason up and running on a windows xp pro dev machine. : Does anyone know of any good install tutorials? : I have apache up and running. : I have mod_perl from ppm up and running. : But am having no luck get

Html::mason

2003-06-13 Thread Paul Kraus
I am trying to get mason up and running on a windows xp pro dev machine. Does anyone know of any good install tutorials? I have apache up and running. I have mod_perl from ppm up and running. But am having no luck getting mason installed. The required modules in the install notes are not on ppm an

Re: How to get ddmmyyyy format.

2003-06-13 Thread John W. Krahn
Rob Dixon wrote: > > Ronald Yacketta wrote: > > > > use POSIX; > > > > $TODAY = strftime("%d%m%Y", localtime()); > > > > print $TODAY; > > > > 13062003 > > That's a good way to do it, but the POSIX module is /huge/. If > this is all you want of it then the following is more concise

Re: Something screwy with split

2003-06-13 Thread Steve Grazzini
On Fri, Jun 13, 2003 at 12:28:47PM -0500, James Edward Gray II wrote: > On Friday, June 13, 2003, at 12:01 PM, [EMAIL PROTECTED] wrote: > > >my @user=(split(/:/,(@passwd=(split(/\n/,`cat /etc/passwd`)))[0])); > > I'm not 100% sure how your /etc/passwd is formatted, but if the name is > before t

Re: Writing Platform Independant Perl Code

2003-06-13 Thread John W. Krahn
Perl_beginner wrote: > > Hello all, Hello, > I have finished writing up a neat Perl server which works > just fine on Linux. I want to see it work seamlessly on > other platforms too (Windows/*Nix) perldoc perlport perldoc perltrap perldoc perlwin32 perldoc perl[your operating system] > T

RE: How to get ddmmyyyy format.

2003-06-13 Thread Yacketta, Ronald
doesn't this limit to what is used with respect to POSIX? use POSIX qw(strftime); then you could use strftime and eliminate my @dmy = (localtime)[3..5]; $dmy[1] ++; $dmy[2] += 1900; my $dmy = sprintf "%02d%02d%04d", @dmy; -Ron -Original Message- From: Rob Dixon To: [EMAIL PRO

Re: How to get ddmmyyyy format.

2003-06-13 Thread Rob Dixon
Ronald Yacketta wrote: > From: Praful Bajaria [mailto:[EMAIL PROTECTED] > > > > > > All, > > > > How would I get ddmm format of time in a variable. > > Once I get this format (value in variable),I would > > like to append to a file. > > > > $currtime = time(); > > @currtime = gmtime($currtime);

Re: Writing Platform Independant Perl Code

2003-06-13 Thread James Edward Gray II
On Friday, June 13, 2003, at 01:43 PM, perl_beginner wrote: Hello all, Hello again. Thanks for the reply James, Sure thing. Mind if I have another go? A resolution to the first issue will help me handle 1. Platform specific OS signals I'm not sure what you mean here, can you give an example

Re: Writing Platform Independant Perl Code

2003-06-13 Thread perl_beginner
Hello all, Thanks for the reply James, A resolution to the first issue will help me handle 1. Platform specific OS signals 2. Platform specific File system operations (eg. cp versus copy) Maybe there is a package that will help me clear 2. - Santosh --- Original Message --

Re: How to get ddmmyyyy format.

2003-06-13 Thread John W. Krahn
Praful Bajaria wrote: > > All, Hello, > How would I get ddmm format of time in a variable. > Once I get this format (value in variable),I would > like to append to a file. > > $currtime = time(); > @currtime = gmtime($currtime); > print " @currtime \n "; > > but the above code doen't give

Re: Something screwy with split

2003-06-13 Thread James Edward Gray II
On Friday, June 13, 2003, at 12:54 PM, [EMAIL PROTECTED] wrote: password file format user:passwd:uid:gid:gecos:homedir:shell I need to be able to change any of the fields within each user record. While having the hash key remain the same user across many files. I'm not sure I understand the que

Re: Something screwy with split

2003-06-13 Thread John W. Krahn
Royce Wells wrote: > > I am trying to split off the user name and the password record in one pass > through however what I am getting is only the first record is being > populated into my user array. > > Can someone tell me am I going about this the right way? You should probably use perl's buil

Re: Writing Platform Independant Perl Code

2003-06-13 Thread James Edward Gray II
On Friday, June 13, 2003, at 12:51 PM, perl_beginner wrote: Hello all, I have finished writing up a neat Perl server which works just fine on Linux. I want to see it work seamlessly on other platforms too (Windows/*Nix) The first issue that I see, is with people who want to use my server on

Re: Windows command line Search and Replace

2003-06-13 Thread John W. Krahn
Greg Carrara wrote: > > Hello, Hello, > I'm trying to search for a word and replace it multiple files at a windows > command prompt with the following: > > perl -pi -e 's/wordToFind/replaceWithThisWord/gi'*.fileExtension > > This errors out. I've tried to replace the delimiters / with - to no

Writing Platform Independant Perl Code

2003-06-13 Thread perl_beginner
Hello all, I have finished writing up a neat Perl server which works just fine on Linux. I want to see it work seamlessly on other platforms too (Windows/*Nix) The first issue that I see, is with people who want to use my server on Windows. Directory seperators ('/' -> '\\') have to be chan

Re: Something screwy with split

2003-06-13 Thread Casey West
It was Friday, June 13, 2003 when [EMAIL PROTECTED] took the soap box, saying: : Can someone tell me am I going about this the right way? : : my @user=(split(/:/,(@passwd=(split(/\n/,`cat /etc/passwd`)))[0])); : for($i=0;$i <= $#passwd ; $i++) : { : print "$user[$i]\n"; : print "$passwd[$i]\n"; :

Re: Something screwy with split

2003-06-13 Thread James Edward Gray II
On Friday, June 13, 2003, at 12:01 PM, [EMAIL PROTECTED] wrote: I am trying to split off the user name and the password record in one pass through however what I am getting is only the first record is being populated into my user array. Can someone tell me am I going about this the right way? H

RE: ABOR message using Net::FTP

2003-06-13 Thread Aman Thind
Hi Wiggins The appearance of ABOR is extremely random. I've successfully uploaded huge files with this script without any issues. So this is possibly being generated by the server I'm uploading my files to...but WHY ? I used the debug flag for the ftp and here's an excerpt of the output : Net::

Something screwy with split

2003-06-13 Thread royce . wells
This works but does anyone have any ideas on the previous question? while( ) { $line=$_; chomp($line); @list=split(/:/,$line); $account_key=$list[0]; $account=join ":",@list; $record{$account_key}=$account; } I am trying to split

Something screwy with split

2003-06-13 Thread royce . wells
I am trying to split off the user name and the password record in one pass through however what I am getting is only the first record is being populated into my user array. Can someone tell me am I going about this the right way? Thanks, Royce my @user=(split(/:/,(@passwd=(split(/\n/,`cat /etc

RE: ABOR message using Net::FTP

2003-06-13 Thread wiggins
On Fri, 13 Jun 2003 21:18:32 +0530, Aman Thind <[EMAIL PROTECTED]> wrote: > Hi > > My ftp script sometimes stops working after throwing an ABOR message :( > > I invoke the ftp as : > > $ftp->append(\*FH,$remotefile)||Reconnect(); > > But when A

RE: How to get ddmmyyyy format.

2003-06-13 Thread Praful Bajaria
Ron, Thanks a lot for your quick help. I really appreciat it. Thanks Praful --- "Yacketta, Ronald" <[EMAIL PROTECTED]> wrote: > use Time::Local; > use POSIX; > > $TODAY = strftime("%d%m%Y", > localtime()); > > print $TODAY; > > 13062003 > > > -Original Message- > From

RE: How to get ddmmyyyy format.

2003-06-13 Thread Yacketta, Ronald
use Time::Local; use POSIX; $TODAY = strftime("%d%m%Y", localtime()); print $TODAY; 13062003 -Original Message- From: Praful Bajaria [mailto:[EMAIL PROTECTED] Sent: Friday, June 13, 2003 12:02 To: [EMAIL PROTECTED] Subject: How to get ddmm format. All, How would

Re: Regex Consult

2003-06-13 Thread Robin Norwood
Peter Fleck <[EMAIL PROTECTED]> writes: > >Peter Fleck [mailto:[EMAIL PROTECTED] > >: > >: ( > >: $date=~/^((\d\d?)\/(\d\d?)\/(((\d{2,2}))|(\d{4,4})))($|(,(\s*) > >: ((\d\d?)\/(\d\d?)\/(((\d{2,2}))|(\d{4,4}+$)/ > >: ) > > > > What about split: > > > >my @dates = split m#/|,\s*#, 'mm/dd/yy,

RE: Perl -w odd error

2003-06-13 Thread Yacketta, Ronald
The Or die ""; is force of habit, hard to teach and old dog new tricks :) I just found out about Fatal this past week and started to use it... -Ron -Original Message- From: Bob Showalter [mailto:[EMAIL PROTECTED] Sent: Friday, June 13, 2003 11:56 To: 'Yacketta, Ronald'; [EMAIL PROTE

How to get ddmmyyyy format.

2003-06-13 Thread Praful Bajaria
All, How would I get ddmm format of time in a variable. Once I get this format (value in variable),I would like to append to a file. $currtime = time(); @currtime = gmtime($currtime); print " @currtime \n "; but the above code doen't give me . Thanks Praful

ABOR message using Net::FTP

2003-06-13 Thread Aman Thind
Hi My ftp script sometimes stops working after throwing an ABOR message :( I invoke the ftp as : $ftp->append(\*FH,$remotefile)||Reconnect(); But when ABOR comes, reconnect is not called. However if i take my machine out of the network while doing the ftp, it invokes Reconnect() as it should.

RE: Perl -w odd error

2003-06-13 Thread Bob Showalter
Yacketta, Ronald wrote: > The problem is with the "use" statement use Fatal qw(open close); For > some reason if I do > > use Fatal qw(open close); > > I get the error, but if I do a > use Fatal; > > I don't... 1. The idea behind Fatal is that you can omit the "or die..." stuff from your open(

RE: Perl -w odd error

2003-06-13 Thread Yacketta, Ronald
Got a fix :) Keep the use Fatal qw/open close/; and then in the block of code add $CNTFILE to the my() and change all CNTFILE's to $CNTFILE -Ron -Original Message- From: Yacketta, Ronald [mailto:[EMAIL PROTECTED] Sent: Friday, June 13, 2003 11:43 To: [EMAIL PROTECTED] Subject: RE: Per

RE: Perl -w odd error

2003-06-13 Thread Yacketta, Ronald
The problem is with the "use" statement use Fatal qw(open close); For some reason if I do use Fatal qw(open close); I get the error, but if I do a use Fatal; I don't... -Ron -Original Message- From: Bob Showalter [mailto:[EMAIL PROTECTED] Sent: Friday, June 13, 2003 10:45 To: 'Yacket

Re: Windows command line Search and Replace

2003-06-13 Thread Jenda Krynicky
From: GREG CARRARA <[EMAIL PROTECTED]> > Hello, > I'm trying to search for a word and replace it multiple files at a > windows command prompt with the following: > > perl -pi -e 's/wordToFind/replaceWithThisWord/gi'*.fileExtension > > This errors out. I've tried to replace the delimiters / with

Windows command line Search and Replace

2003-06-13 Thread GREG CARRARA
Hello, I'm trying to search for a word and replace it multiple files at a windows command prompt with the following: perl -pi -e 's/wordToFind/replaceWithThisWord/gi'*.fileExtension This errors out. I've tried to replace the delimiters / with - to no effect. Does someone know how to alter this

RE: Perl -w odd error

2003-06-13 Thread Bob Showalter
Yacketta, Ronald wrote: > Rob, > > Line 151 _IS_ @FILE=; and here is the entire block of code > > sub OTTExecute() > { > system($ExecCmd); > $success = $? >> 8; > printNotice ("$success\n"); > > if ( ! $success ) > { > my ($record_count, @

RE: Perl -w odd error

2003-06-13 Thread Yacketta, Ronald
Rob, Line 151 _IS_ @FILE=; and here is the entire block of code sub OTTExecute() { system($ExecCmd); $success = $? >> 8; printNotice ("$success\n"); if ( ! $success ) { my ($record_count, @FILE); open (CNTFILE, "${OUTPUTFIL

Re: Perl -w odd error

2003-06-13 Thread Rob Dixon
Ronald Yacketta wrote: > Folks, > > I have the following block of code: > > open (CNTFILE, "${OUTPUTFILE}") or die "Can't open ${OUTPUTFILE} : > $!"; > @FILE=; > close(CNTFILE); > > Which reports this warning: > > Name "main::CNTFILE" used only once: possible typo at ./Order

Re: pattern matching problems

2003-06-13 Thread Rob Dixon
Chern Jian Leaw wrote: > HI, > I have a script attached in this mail which reads the output of rpcinfo and > tokenizes its outputs. This problem is similar to my earlier posting a few > days ago. However, in this scenario, the some outputs of rpcinfo response > i.e. "rpcinfo: RPC: Timed out progr

RE: Perl -w odd error

2003-06-13 Thread Yacketta, Ronald
That goes against everything perl ;) why not _slurp_ the entire file in (which is 100% perl legal) (@FILE=;) -Ron -Original Message- From: Miller, Joseph S [mailto:[EMAIL PROTECTED] Sent: Thursday, June 12, 2003 17:25 To: Yacketta, Ronald; [EMAIL PROTECTED] Subject: RE: Perl -w odd error

pattern matching problems

2003-06-13 Thread Leaw, Chern Jian
HI, I have a script attached in this mail which reads the output of rpcinfo and tokenizes its outputs. This problem is similar to my earlier posting a few days ago. However, in this scenario, the some outputs of rpcinfo response i.e. "rpcinfo: RPC: Timed out program 1073741825 version 1 is not av

Re: A Common.pm....and defining standard string to use elsewhere....

2003-06-13 Thread Rob Dixon
Hamish Whittal wrote: > Hello you very able, helpful people > > I have a Common.pm module used throughout all my other modules. > > I have the following: > > our @EXPORT = qw/$ERRORSTRING $DAY $MONTH $YEAR/; > > ($DAY, $MONTH, $YEAR) = (localtime)[3,4,5]; > $YEAR+=1900; > $MONTH+=1; > $ERRORSTR

Re: misunderstanding the /g modifier on REGEX

2003-06-13 Thread Rob Dixon
M Z wrote: > hello all - > > I am trying to do the following to this data: > input: > X|YZ||A > > desired output: > X|Y| | | |Z| |A > > simply replacing || with | | > whereever it may occur in the string. > > This bit of code doesn't seem to do all of the job. > > What is wrong with this code?

A Common.pm....and defining standard string to use elsewhere....

2003-06-13 Thread Hamish Whittal
Hello you very able, helpful people I have a Common.pm module used throughout all my other modules. I have the following: our @EXPORT = qw/$ERRORSTRING $DAY $MONTH $YEAR/; ($DAY, $MONTH, $YEAR) = (localtime)[3,4,5]; $YEAR+=1900; $MONTH+=1; $ERRORSTRING = q($DAY/$MONTH/$YEAR ERROR [$this] :

Re: misunderstanding the /g modifier on REGEX

2003-06-13 Thread John W. Krahn
Tim Johnson wrote: > > I'm not really giving you the answer you're looking for, but here is one way > to go about it: > > while(<>){ > my @temp = split(/\|/,$_); > foreach my $item(@temp){ > if($item eq ''){ > $item .= ' '; > } > } > print join('|',@temp); > } Or you could

Re: misunderstanding the /g modifier on REGEX

2003-06-13 Thread Sudarshan Raghavan
Tim Johnson wrote: David, if you don't mind, could you give an explanation of what you're doing here? I'm not sure if everyone is familiar with the method you're using to look ahead. I will take a crack at this -Original Message- From: david [mailto:[EMAIL PROTECTED] Sent: Thursday, Ju