RE: Perl help

2006-07-17 Thread Sayed, Irfan \(Irfan\)
tried. but still same error. regards irfan. -Original Message- From: Owen Cook [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 18, 2006 12:11 PM To: Sayed, Irfan (Irfan) Cc: beginners@perl.org Subject: Re: Perl help On Tue, 18 Jul 2006, Sayed, Irfan (Irfan) wrote: > > I am executin

Re: Perl help

2006-07-17 Thread Owen Cook
On Tue, 18 Jul 2006, Sayed, Irfan (Irfan) wrote: > > I am executing following code > > foreach (@vob_list) > { > my @repl = `$CT lsreplica -invob $_ | grep cmvobsvr1mum`; > print @repl; > } > > but i am not getting proper output for grep It is probably looking for the system grep.

Perl help

2006-07-17 Thread Sayed, Irfan \(Irfan\)
Hi , I am executing following code foreach (@vob_list) { my @repl = `$CT lsreplica -invob $_ | grep cmvobsvr1mum`; print @repl; } but i am not getting proper output for grep can anybody plz help me Regards Irfan.

Re: pattern matching

2006-07-17 Thread John W. Krahn
Ryan Dillinger wrote: > Hello All, Hello, > I was studying some pattern matching. And I ran into this piece of code. > Now I believe I understand it up until the the last part \1. > Can someone explain it for me please? > Match lowercase a through z, uppercase A through lc z That must be a mista

Re: pattern matching

2006-07-17 Thread Alan_C
On Monday 17 July 2006 18:20, Timothy Johnson wrote: > \1 is the same thing as $1 inside of a regex, but it is generally > recommended that you don't use it. I thought it's ok to use it in a match or on the *left* side (but not on the right side) of a substitution >> then I'm stumped, what's the

Re: pattern matching

2006-07-17 Thread Tom Phoenix
On 7/17/06, Ryan Dillinger <[EMAIL PROTECTED]> wrote: Now I believe I understand it up until the the last part \1. /([a-zA-z]{3})\s*\1/ That's a backreference; it matches if the corresponding part of the string is equal to what's in memory one at the time of the match. Memory one holds the

RE: pattern matching

2006-07-17 Thread Timothy Johnson
\1 is the same thing as $1 inside of a regex, but it is generally recommended that you don't use it. >From 'perldoc perlre': " Warning on \1 vs $1 Some people get too used to writing things like: $pattern =~ s/(\W)/\\\1/g; This is grandfathered for the RHS of a substitute to

pattern matching

2006-07-17 Thread Ryan Dillinger
Hello All, I was studying some pattern matching. And I ran into this piece of code. Now I believe I understand it up until the the last part \1. Can someone explain it for me please? Match lowercase a through z, uppercase A through lc z no more than three times, with white space zero or one times

Re: misunderstanding with the function split

2006-07-17 Thread John W. Krahn
sfantar wrote: > John W. Krahn a écrit : >> >> #!/usr/local/bin/perl >> use strict; >> use warnings; >> >> my @authors; >> my @titles; >> >> >> for my $file ( @ARGV ) { >> $file =~ tr/ /_/; >> >> my ( $author, $title ) = split /-/, $file; >> >> push @authors, $author; >> push @title

Re: misunderstanding with the function split

2006-07-17 Thread sfantar
John W. Krahn a écrit : sfantar wrote: Hello everyone Hello, I would like to be able to print the songs'titles according to the author. The format of the songs are as follow : Freda Payne - In motion.mp3 Sylvester - Was it something that i said.mp3 George Benson & A. Franklin - Love All The

Re: misunderstanding with the function split

2006-07-17 Thread John W. Krahn
sfantar wrote: > Hello everyone Hello, > I would like to be able to print the songs'titles according to the author. > The format of the songs are as follow : > > Freda Payne - In motion.mp3 > Sylvester - Was it something that i said.mp3 > George Benson & A. Franklin - Love All The Hurt Away.mp3

misunderstanding with the function split

2006-07-17 Thread sfantar
Hello everyone I would like to be able to print the songs'titles according to the author. The format of the songs are as follow : Freda Payne - In motion.mp3 Sylvester - Was it something that i said.mp3 George Benson & A. Franklin - Love All The Hurt Away.mp3 #!/usr/local/bin/perl -w use s

Thanks for newbie answer

2006-07-17 Thread Rod Burgess
I appreciate all of your assistance with my eariler question. It is amazing how many different variations of Perl scripts that can be used to come up with the same results. The best part was showing my co-worker just what Perl can do. Thanks again. Rod -- To unsubscribe, e-mail: [EMAIL PROTE

Re: Help with Stupid question

2006-07-17 Thread Peter Cornelius
printf will round. Try it: printf ("should be 25.8 : %.1f$/", 25.79); prints: should be 25.8 : 25.8 Just one caveat here: as I understand it, sprintf() will not round the decimal, it will just truncate it, so if you need to round up or down the number, I would suggest looking through the math

Re: Newbie Perl Question

2006-07-17 Thread Peter Cornelius
On Jul 17, 2006, at 11:33 AM, Maxim wrote: But I am totally frustrated in regexp part in the script: /^DR\d+.*?(\d+).*?(\d+)(.+)/ Could you please explain it? Or maybe you have a link to intelligible guide for perl regexp? perldoc perlre is a pretty detailed description of perl's regexp.

Re: Newbie Perl Question

2006-07-17 Thread Peter Hoose
I'm pretty new myself, as such I like to see a little more error checking to accomodate for mine (or other people's) mistakes, here's one similar to Rob's but with some additional error checking that you might want, basically the main difference is that it expects your lines to be formatted like

RE: Help with Stupid question

2006-07-17 Thread Timothy Johnson
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tom Phoenix Sent: Saturday, July 15, 2006 3:22 PM To: Ralph H. Stoos Jr. Cc: beginners perl Subject: Re: Help with Stupid question >> On 7/15/06, Ralph H. Stoos Jr. <[EMAIL PROTECTED]> wrote: >> >> I want to

Re: Newbie Perl Question

2006-07-17 Thread Rob Dixon
Rod Burgess wrote: > > I am new to the Perl world and am trying to learn it. A coworker tells me > that Perl will not work for what I am trying to do however, I think Perl > would be a great tool to use and I feel this coworker is wrong. > I have a file that contains several lines all as below:

Re: Newbie Perl Question

2006-07-17 Thread Maxim
Hello Rod, I am not the author of the initial message, but thanks a lot for your reply. I am trying to adopt your script to my need, and, basically, it works for me. But I am totally frustrated in regexp part in the script: /^DR\d+.*?(\d+).*?(\d+)(.+)/ Could you please explain it? Or maybe you h

Re: Newbie Perl Question

2006-07-17 Thread Todd W
""Rod Burgess"" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >I am new to the Perl world and am trying to learn it. A coworker tells me > that Perl will not work for what I am trying to do however, I think Perl > would be a great tool to use and I feel this coworker is wrong. > I

Re: Newbie Perl Question

2006-07-17 Thread Dr.Ruud
"Rod Burgess" schreef: Your Subject has no quality. Please come up with something like "convert data lines". > I am new to the Perl world and am trying to learn it. A coworker > tells me that Perl will not work for what I am trying to do however, > I think Perl would be a great tool to use and

Newbie Perl Question

2006-07-17 Thread Rod Burgess
I am new to the Perl world and am trying to learn it. A coworker tells me that Perl will not work for what I am trying to do however, I think Perl would be a great tool to use and I feel this coworker is wrong. I have a file that contains several lines all as below: DR03555{tab}45600062888{t

Newbie Perl Question

2006-07-17 Thread Rod Burgess
I am new to the Perl world and am trying to learn it. A coworker tells me that Perl will not work for what I am trying to do however, I think Perl would be a great tool to use and I feel this coworker is wrong. I have a file that contains several lines all as below: DR03555{tab}45600062888{t

Re: write out filenames of files existing on a filesystem into afile

2006-07-17 Thread Rob Dixon
John W. Krahn wrote: Rob Dixon wrote: To check whether a directory's empty or not you need to read /that/ directory in turn. Not necessarily, you should be able to tell by stat()ing the size of the directory (this works on Linux, I don't know about DOS/Windows.) Thanks John As far as I can

Re: Perl Beginner

2006-07-17 Thread Venkat Saranathan
Brian, Welcome to Perl. I would suggest couple of good books, lot of practice and of course watching this mailing list. Please feel free to check out the following blog entry if you like. Others, please feel free to add anything that I may have missed. http://www.gulfsoft.com/modules.php?

Re: Perl issue

2006-07-17 Thread Dr.Ruud
John W. Krahn schreef: > system( $CT, 'lsreplica', '-fmt', '%[master]p\n', '-invob', $a ) == 0 > or die "system $CT failed: $?"; Yes, much better than anything I suggested. -- Affijn, Ruud "Gewoon is een tijger." -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-m

Re: Perl issue

2006-07-17 Thread John W. Krahn
Sayed, Irfan (Irfan) wrote: > Hi, Hello, > I am executing following perl script > > # perl script to change the hostname of every replica / VOB > > use strict; > > my $CT = "ct"; > > my @vob_list = `$CT lsvob -s`; Assuming that 'ct lsvob -s' outputs the list: \openssl_openssl \openssl_

RE: Perl issue

2006-07-17 Thread Jeff Peng
Give a try on changing this line: `$CT lsreplica -fmt %[master]p\n -invob $a`; to: `$CT lsreplica -fmt \%[master]p\n -invob $a`; -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: Perl issue

2006-07-17 Thread Sayed, Irfan \(Irfan\)
\n means a newline character. I tried putiing '' around the $a but still same error. plz help Regards Irfan. -Original Message- From: Dr.Ruud [mailto:[EMAIL PROTECTED] Sent: Monday, July 17, 2006 5:30 PM To: beginners@perl.org Subject: Re: Perl issue "Sayed, Irfan (Irfan)" schreef:

Re: Perl issue

2006-07-17 Thread Dr.Ruud
"Sayed, Irfan (Irfan)" schreef: > foreach my $a (@vob_list) > { >print $a; > `$CT lsreplica -fmt %[master]p\n -invob $a`; Why is the \n in there? Is it meant as a literal, or as a newline? I think you need '' around (the contents of) $a. -- Affijn, Ruud "Gewoon is een tijger."

Perl issue

2006-07-17 Thread Sayed, Irfan \(Irfan\)
Hi, I am executing following perl script # perl script to change the hostname of every replica / VOB use strict; my $CT = "ct"; my @vob_list = `$CT lsvob -s`; print "Following are the VOBs / Replicas whose hostname needs to be change \n"; print @vob_list; foreach my $a (@vob_list)

Re: write out filenames of files existing on a filesystem into afile

2006-07-17 Thread Dr.Ruud
Rob Dixon schreef: > Nishi Bhonsle wrote: > > > > If I am still using the below logic, how can i modify the below > prog > to ignore empty directories and list only directories > containing > directories > > and files in buildlist.txt ? > > > > opendir DIR, $path or die "Can't open $path: $!

Re: write out filenames of files existing on a filesystem into afile

2006-07-17 Thread John W. Krahn
Rob Dixon wrote: > Nishi Bhonsle wrote: >> >> If I am still using the below logic, how can i modify the below prog >> to ignore empty directories and list only directories containing >> directories >> and files in buildlist.txt ? >> >> opendir DIR, $path or die "Can't open $path: $!"; >> >> #my @n

Re: write out filenames of files existing on a filesystem into afile

2006-07-17 Thread Rob Dixon
Nishi Bhonsle wrote: > > If I am still using the below logic, how can i modify the below prog > to ignore empty directories and list only directories containing > directories > and files in buildlist.txt ? > > opendir DIR, $path or die "Can't open $path: $!"; > > #my @new = grep /[^.]/, readdir D

Re: manipulate strings to strip the beginning part

2006-07-17 Thread Rob Dixon
Nishi Bhonsle wrote: > > I want to manipulate strings containing filenames that have the following > format > Web\SiA\web\..\..\ etc > Web\SiAData\web\app\..\..\ etc > to remove everything in the begining of web part of the above strings and > store the rest of the part ie > web\..\..\ into a new