RE: Calculating Column Averages from a CSV File

2007-08-09 Thread Purohit, Bhargav
Hi for($index=1; $index<10; $index++) {} Is the villain of the programme On first loop itself it read out full file. And every thing was stored w.r.t index=1; As after that file's while loop never gets executed because of EOF of that file. Ur first logic is correct and I think the second one is

Re: Find and replace from CSV

2007-08-09 Thread Jeff Pang
-Original Message- >From: Jeff Pang <[EMAIL PROTECTED]> >#!/bin/sh >FILE=$1 >REPLACED=$2 >REPLACEMENT=$3 > >perl -pi.bak -e 's/\Q$REPLACED\E/$REPLACEMENT/' $FILE >echo "DONE" > Found the problem,here shell variables can't be passed into Perl program. Maybe using environment variables,or

Re: Moving Files, subfolders

2007-08-09 Thread Chas Owens
On 8/9/07, Mr. Shawn H. Corey <[EMAIL PROTECTED]> wrote: > Mr. Shawn H. Corey wrote: > > Evyn wrote: > >> ... how would > >> I keep the structure? > > > > #!/usr/bin/perl > > > > use strict; > > use warnings; > > > > use File::Basename; > > use File::Copy; > > use File::Find; > > use File::Path; >

Re: Find and replace from CSV

2007-08-09 Thread Jeff Pang
-Original Message- >From: [EMAIL PROTECTED] >Sent: Aug 9, 2007 11:12 PM >To: beginners@perl.org >Subject: Find and replace from CSV > >Hi, I am new to Perl. > >I am trying to replace a string within a bunch of html files. > >Ideally, I would like to have the file name pulled from a list i

Re: Moving Files, subfolders

2007-08-09 Thread Mr. Shawn H. Corey
John W. Krahn wrote: Instead of dirname( $File::Find::name ) why not $File::Find::dir? Why not? I'm still trying to adjust to reliable systems; sometimes I think too much DOS. Or, in other words, "Just because you're not paranoid, doesn't mean computers are out to get me!" -- Just my 0.0

Calculating Column Averages from a CSV File

2007-08-09 Thread country
I am trying to calculate column averages (excluding 0's) for all the columns in a CSV file except the first column. My input CSV file is as follows: pickcpua.dat IMAGINGNY,1.45,0.42,1.54,1.49,1.47,1.36,1.81,0.47,1.8,0.55,0.38 JBSQLTST,1.29,1.09,1.13,1.88,1.11,1.44,1.25,1.23,1.05,1.39,1.61 SNYCSQ

Re: Moving Files, subfolders

2007-08-09 Thread John W. Krahn
Mr. Shawn H. Corey wrote: Evyn wrote: ... how would I keep the structure? #!/usr/bin/perl use strict; use warnings; use File::Basename; use File::Copy; use File::Find; use File::Path; my $SrcDir = '.'; # Set to the source directory my $DstDir = 'c:\\Documents\\AudioDownloadsWaiting\\'; su

Re: Moving Files, subfolders

2007-08-09 Thread Mr. Shawn H. Corey
Mr. Shawn H. Corey wrote: Evyn wrote: ... how would I keep the structure? #!/usr/bin/perl use strict; use warnings; use File::Basename; use File::Copy; use File::Find; use File::Path; my $SrcDir = '.'; # Set to the source directory my $DstDir = 'c:\\Documents\\AudioDownloadsWaiting\\'; su

Re: Moving Files, subfolders

2007-08-09 Thread Mr. Shawn H. Corey
Evyn wrote: ... how would I keep the structure? #!/usr/bin/perl use strict; use warnings; use File::Basename; use File::Copy; use File::Find; use File::Path; my $SrcDir = '.'; # Set to the source directory my $DstDir = 'c:\\Documents\\AudioDownloadsWaiting\\'; sub wanted { if( m{ \.gar \

Re: qw with strings containing spaces

2007-08-09 Thread usenet
On Aug 9, 11:58 am, [EMAIL PROTECTED] (Mathew Snyder) wrote: > What I am doing is declaring an array and assigning the value: > @array = qw/All "A - H" "I - P" "Q - Z"/; You don't want qw{} here. Just do it the brute-force way: @array = ("All", "A - H", "I - P", "Q - Z"); -- The best way to

Re: Moving Files, subfolders

2007-08-09 Thread Evyn
The structure is not important thanks, but out of interest, how would I keep the structure? I followed Chas Owen's suggestion and solved the immediate problem, thanks! On Aug 9, 12:23 pm, [EMAIL PROTECTED] (Mr. Shawn H. Corey) wrote: > Q: Do you want to keep the subfolder structure or do all th

Re: Compare two different files.

2007-08-09 Thread Jay Savage
On 8/9/07, Jason <[EMAIL PROTECTED]> wrote: > I think I didn't post my question properly. > The text file will be having different field values with alon with > some headers. > A java program will parse the file and create a java object with the > same field values and headers, but the position and

Re: trying to get unicode to work in perl

2007-08-09 Thread Mr. Shawn H. Corey
tom arnall wrote: I'm trying to get unicode to work in perl. When I do the 'textbook' example: [EMAIL PROTECTED]:~$ perl -e'binmode(STDOUT, ":utf8"); print chr(0x263a)' I get garbage, not a smiley face, i.e.: ⺠What version of perl? (Enter `perl -v`) perl 5.8.+ works well with UT

Re: Array reformatting problem

2007-08-09 Thread [EMAIL PROTECTED]
On Aug 9, 5:38 pm, [EMAIL PROTECTED] (Mr. Shawn H. Corey) wrote: > minky arora wrote: > > Hello Team, > > > I have a problem and I need some ideas to put me on the right track to > > form an algo: > > > I have four 8x12 arrays (Arr1,Arr2, Arr3,Arr4) and ONE 16x24 (ARR5) array. > > > Now these four

Re: Array reformatting problem

2007-08-09 Thread [EMAIL PROTECTED]
On Aug 9, 5:13 pm, [EMAIL PROTECTED] (Minky Arora) wrote: > Hello Team, > > I have a problem and I need some ideas to put me on the right track to > form an algo: > > I have four 8x12 arrays (Arr1,Arr2, Arr3,Arr4) and ONE 16x24 (ARR5) array. Please define "I have". You are not talking about arrays

trying to get unicode to work in perl

2007-08-09 Thread tom arnall
I'm trying to get unicode to work in perl. When I do the 'textbook' example: [EMAIL PROTECTED]:~$ perl -e'binmode(STDOUT, ":utf8"); print chr(0x263a)' I get garbage, not a smiley face, i.e.: ⺠My environment is: [EMAIL PROTECTED]:~$ env SSH_AGENT_PID=3589 TERM=xterm SHELL=/bin/bash

Re: qw with strings containing spaces

2007-08-09 Thread Mathew Snyder
John W. Krahn wrote: > Mathew Snyder wrote: >> I need to populate a select multiple on a web page when it loads with >> a series >> of values. Most of the values will be determined dynamically when the >> code runs >> but some are static. They look like "A - H", "I - P" and "Q - Z". >> The space

Re: qw with strings containing spaces

2007-08-09 Thread John W. Krahn
Mathew Snyder wrote: I need to populate a select multiple on a web page when it loads with a series of values. Most of the values will be determined dynamically when the code runs but some are static. They look like "A - H", "I - P" and "Q - Z". The spaces are for readability. What I am doing

Re: qw with strings containing spaces

2007-08-09 Thread Flemming Greve Skovengaard
Mathew Snyder wrote: I need to populate a select multiple on a web page when it loads with a series of values. Most of the values will be determined dynamically when the code runs but some are static. They look like "A - H", "I - P" and "Q - Z". The spaces are for readability. What I am doing

qw with strings containing spaces

2007-08-09 Thread Mathew Snyder
I need to populate a select multiple on a web page when it loads with a series of values. Most of the values will be determined dynamically when the code runs but some are static. They look like "A - H", "I - P" and "Q - Z". The spaces are for readability. What I am doing is declaring an array

Re: Find and replace from CSV

2007-08-09 Thread Paul Lalli
On Aug 9, 11:12 am, [EMAIL PROTECTED] wrote: > I am trying to replace a string within a bunch of html files. so why does your subject say CSV? > Ideally, I would like to have the file name pulled from a list in a > text file, open the file, search for the string that will be replaced > withi

xml rpc version for perl 5.005

2007-08-09 Thread vishnu
hi Is there any specific xml::Rpc version that runs in perl 5.005. -- Vishnu, "if you don't make mistakes, chances are you are not stretching yourself."

Re: slices

2007-08-09 Thread Paul Lalli
On Aug 9, 10:39 am, [EMAIL PROTECTED] wrote: > - Original Message - > From: Paul Lalli <[EMAIL PROTECTED]> > Date: Thursday, August 9, 2007 8:52 am > Subject: Re: slices > To: [EMAIL PROTECTED] > > > $ perl -wle'my @bar = qw/alpha beta gamma/; @bar[()] = (1, 2, 3); > >

Re: How do you use Perl?

2007-08-09 Thread Paul Lalli
On Aug 9, 11:25 am, [EMAIL PROTECTED] (John W. Krahn) wrote: > Paul Lalli wrote: > > On Aug 9, 10:07 am, [EMAIL PROTECTED] (Oryann9) wrote: > > >> Paul, what college? > > > Rensselaer Polytechnic Institute, Troy, NY > > >http://www.cs.rpi.edu/~lallip/perl/spring07 > > On that page at the Sunday, Ma

Re: Array reformatting problem

2007-08-09 Thread Mr. Shawn H. Corey
minky arora wrote: Hello Team, I have a problem and I need some ideas to put me on the right track to form an algo: I have four 8x12 arrays (Arr1,Arr2, Arr3,Arr4) and ONE 16x24 (ARR5) array. Now these four arrays are formatted in a particular way by a robot( these are actually plates with well

Re: slices

2007-08-09 Thread kviel
- Original Message - From: Paul Lalli <[EMAIL PROTECTED]> Date: Thursday, August 9, 2007 8:52 am Subject: Re: slices To: beginners@perl.org > $ perl -wle'my @bar = qw/alpha beta gamma/;  @bar[()] = (1, 2, 3);    

Re: How do you use Perl?

2007-08-09 Thread John W. Krahn
Paul Lalli wrote: On Aug 9, 10:07 am, [EMAIL PROTECTED] (Oryann9) wrote: Paul, what college? Rensselaer Polytechnic Institute, Troy, NY http://www.cs.rpi.edu/~lallip/perl/spring07 Also on your page at: http://cgi2.cs.rpi.edu/~lallip/perl/spring07/regexp_notes.shtml you say: ^.* and .*

Array reformatting problem

2007-08-09 Thread minky arora
Hello Team, I have a problem and I need some ideas to put me on the right track to form an algo: I have four 8x12 arrays (Arr1,Arr2, Arr3,Arr4) and ONE 16x24 (ARR5) array. Now these four arrays are formatted in a particular way by a robot( these are actually plates with wells ..I am dealing with

Find and replace from CSV

2007-08-09 Thread kevc73
Hi, I am new to Perl. I am trying to replace a string within a bunch of html files. Ideally, I would like to have the file name pulled from a list in a text file, open the file, search for the string that will be replaced within the file, pull the replacement string from another file, then replac

Re: How do you use Perl?

2007-08-09 Thread John W. Krahn
Paul Lalli wrote: On Aug 9, 10:07 am, [EMAIL PROTECTED] (Oryann9) wrote: Paul, what college? Rensselaer Polytechnic Institute, Troy, NY http://www.cs.rpi.edu/~lallip/perl/spring07 On that page at the Sunday, March 25, 2007 entry: if (! $value) { ... } # $value is either 0, '', '0', or un

Re: How do you use Perl?

2007-08-09 Thread Jeff Pang
-Original Message- >From: Paul Lalli <[EMAIL PROTECTED]> >Sent: Aug 9, 2007 10:39 PM >To: beginners@perl.org >Subject: Re: How do you use Perl? > >On Aug 9, 10:07 am, [EMAIL PROTECTED] (Oryann9) wrote: > >> Paul, what college? > >Rensselaer Polytechnic Institute, Troy, NY > >http://www.cs

Re: Compare two different files.

2007-08-09 Thread Jason
I think I didn't post my question properly. The text file will be having different field values with alon with some headers. A java program will parse the file and create a java object with the same field values and headers, but the position and format may change. Now I want to check if the java p

Re: [OT] How do you use Perl?

2007-08-09 Thread Randal L. Schwartz
> "yitzle" == yitzle <[EMAIL PROTECTED]> writes: yitzle> I enjoy programming. I like learning new languages. I started yitzle> tinkering with Perl, because I always heard of 'scripting languages' yitzle> but never used one. So I started using Perl. I guess you could mark it yitzle> as 'hobby'

Re: How do you use Perl?

2007-08-09 Thread Paul Lalli
On Aug 9, 10:07 am, [EMAIL PROTECTED] (Oryann9) wrote: > Paul, what college? Rensselaer Polytechnic Institute, Troy, NY http://www.cs.rpi.edu/~lallip/perl/spring07 Paul Lalli -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org

Re: Dynamically assign the no.

2007-08-09 Thread Paul Lalli
On Aug 9, 10:04 am, [EMAIL PROTECTED] (Paul Lalli) wrote: > my $i = 1; > for my $line (`cleartool lsproj`) { > print "$i. $line"; $i++; > } > > print "Your choice: \n"; > chomp(my $choice = ); Paul Lalli -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL P

Re: Dynamically assign the no.

2007-08-09 Thread Paul Lalli
On Aug 9, 9:52 am, [EMAIL PROTECTED] (Irfan Sayed) wrote: > Hi All, > > I am running one system command in my perl script. The output of this > command is different every time. sometimes it gives 3 line output > sometimes 4 line output. > > Now my req. is that I need to catch this output and assign

Re: Dynamically assign the no.

2007-08-09 Thread Paul Lalli
On Aug 9, 9:52 am, [EMAIL PROTECTED] (Irfan Sayed) wrote: > I am running one system command in my perl script. The output of this > command is different every time. sometimes it gives 3 line output > sometimes 4 line output. > > Now my req. is that I need to catch this output and assign serial no.s

RE: Dynamically assign the no.

2007-08-09 Thread Moon, John
-Original Message- From: Sayed, Irfan (Irfan) [mailto:[EMAIL PROTECTED] Sent: Thursday, August 09, 2007 9:52 AM To: beginners@perl.org Subject: Dynamically assign the no. Hi All, I am running one system command in my perl script. The output of this command is different every time. some

Re: How do you use Perl?

2007-08-09 Thread oryann9
> > Just be curious to see how do you guys use Perl > for work.Would you be > > pleased to give a vote below? > > > > [a] CGI/Web Development > > [b] System Administration > > [c] mod_perl -- write Apache handler > > [d] write commercial products > > [e] Biological analysis > > [f] others > a an

Re: Timelocal's input parameters

2007-08-09 Thread Peter Scott
On Tue, 07 Aug 2007 22:47:38 -0700, timbo wrote: > Is it possible to pass timelocal a parameter that's already the exact > scalar output of localtime's format "Mon Jan 10 04:30:30 2007"? > > I know the perlfunc documentations for timelocal indicates that > arguments are in the form of ... > > tim

Dynamically assign the no.

2007-08-09 Thread Sayed, Irfan (Irfan)
Hi All, I am running one system command in my perl script. The output of this command is different every time. sometimes it gives 3 line output sometimes 4 line output. Now my req. is that I need to catch this output and assign serial no.s to them. for example : command is " cleartool lsproj"

Re: slices

2007-08-09 Thread Paul Lalli
On Aug 9, 8:29 am, [EMAIL PROTECTED] (Paul Lalli) wrote: > On Aug 8, 11:05 pm, [EMAIL PROTECTED] (John W. Krahn) wrote: > > > > Subject: slices > > > Your examples are not using slices. A slice implies a list (more than one) > > of > > indexes > > No "more than one" required. A 1 element list is

Re: How do you use Perl?

2007-08-09 Thread Paul Lalli
On Aug 9, 12:27 am, [EMAIL PROTECTED] wrote: > Hello list, > > Just be curious to see how do you guys use Perl for work.Would you be > pleased to give a vote below? > > [a] CGI/Web Development > [b] System Administration > [c] mod_perl -- write Apache handler > [d] write commercial products > [e] B

Re: How i convert a excel file to csv file

2007-08-09 Thread Paul Lalli
On Aug 9, 3:22 am, [EMAIL PROTECTED] (Santana) wrote: > Hei friends, > i'am new in newbie in Perl, and i try i convert a excel file in csv > file in Suse 10.0 linux. (1) > I install the Spreadsheet-ParseExcel-0.32.tar.gz module in my linux (2) > use Spreadsheet::ParseExcel; (3) > I have a error

Re: How i convert a excel file to csv file

2007-08-09 Thread Chas Owens
On 8/9/07, Santana <[EMAIL PROTECTED]> wrote: snip > I install the Spreadsheet-ParseExcel-0.32.tar.gz module in my linux > but when i try run this script : snip > I have a error something like this : > > "Can´t locate Spreadsheet.pm in @INC(@INC constains : " snip Chances are good you

Re: [OT] How do you use Perl?

2007-08-09 Thread yitzle
> [a] CGI/Web Development > [b] System Administration > [c] mod_perl -- write Apache handler > [d] write commercial products > [e] Biological analysis > [f] others a; f I enjoy programming. I like learning new languages. I started tinkering with Perl, because I always heard of 'scripting languages

Re: Error in executing the script

2007-08-09 Thread Chas Owens
On 8/9/07, Sayed, Irfan (Irfan) <[EMAIL PROTECTED]> wrote: > Hi all, > > Now I have made two EOT statements and also now I got the same error. I > have removed the space/tab also before EOT. Here is the code snip A space after the EOT will also cause a problem. Have you considered not using HereD

Re: Convert from hex

2007-08-09 Thread Chas Owens
On 8/9/07, kapil.V <[EMAIL PROTECTED]> wrote: > echo > http%3A%2F%2Fwww.merifiles.com%2Fuploads%2Fmf_aR_Ek_Ajnabi_-_01_-_Ek_Ajnabi_%28Mama_Told_Me%29%28128Kbps%29.mp3| > perl -e ' > $_=<>;s/%(..)/\\x$1/xg; > print "$_"; > ' > > This outputs > http\x3A\x2F\x2Fwww.merifiles.com\x2Fuploads\x2Fmf_aR_

Re: slices

2007-08-09 Thread Paul Lalli
On Aug 8, 11:05 pm, [EMAIL PROTECTED] (John W. Krahn) wrote: > > Subject: slices > > Your examples are not using slices. A slice implies a list (more than one) of > indexes No "more than one" required. A 1 element list is a list. @bar[0,1] = `$cmd`; assigns the first two lines of $cmd's output

Re: Convert from hex

2007-08-09 Thread Mr. Shawn H. Corey
kapil.V wrote: echo http%3A%2F%2Fwww.merifiles.com%2Fuploads%2Fmf_aR_Ek_Ajnabi_-_01_-_Ek_Ajnabi_%28Mama_Told_Me%29%28128Kbps%29.mp3| perl -e ' $_=<>;s/%(..)/\\x$1/xg; print "$_"; ' echo http%3A%2F%2Fwww.merifiles.com%2Fuploads%2Fmf_aR_Ek_Ajnabi_-_01_-_Ek_Ajnabi_%28Mama_Told_Me%29%28128Kbps%

RT3 re-install, DBI login problem.

2007-08-09 Thread Gary Stainburn
I've had to build a new server and install RT3 on it. I rebuilt the database no problem, and can access it using psql, see listing 1. I can also access it via DBI in a small perl script, see listing 2. If I supply incorrect passwords to either of these I get the approriate error message. Howev

Convert from hex

2007-08-09 Thread kapil.V
echo http%3A%2F%2Fwww.merifiles.com%2Fuploads%2Fmf_aR_Ek_Ajnabi_-_01_-_Ek_Ajnabi_%28Mama_Told_Me%29%28128Kbps%29.mp3| perl -e ' $_=<>;s/%(..)/\\x$1/xg; print "$_"; ' This outputs http\x3A\x2F\x2Fwww.merifiles.com\x2Fuploads\x2Fmf_aR_Ek_Ajnabi_-_01_-_Ek_Ajnabi_\x28Mama_Told_Me\x29\x28128Kbps\x2

How i convert a excel file to csv file

2007-08-09 Thread Santana
Hei friends, i'am new in newbie in Perl, and i try i convert a excel file in csv file in Suse 10.0 linux. I install the Spreadsheet-ParseExcel-0.32.tar.gz module in my linux but when i try run this script : use strict; use Spreadsheet::ParseExcel; my $excel = Spreadsheet::ParseExcel::Workbo

RE: Error in executing the script

2007-08-09 Thread Sayed, Irfan (Irfan)
Hi all, Now I have made two EOT statements and also now I got the same error. I have removed the space/tab also before EOT. Here is the code sub join_proj() { print "Joining Project..\n"; sleep 2; print <<"EOT"; Select one of the project: 1. APC 2. quit Your

Re: Conditional module loading

2007-08-09 Thread Fermín Galán Márquez
Dear Chas, There is one last case, but it doesn't involve loading A or B, it involves loading A if it is available and setting a flag as to whether it is available or not. For example, I once wrote a Gtk based SQL Editor/Runner. It had the ability to save the result sets to Microsoft Excel fil

Re: Replacing the n'th line with the new line

2007-08-09 Thread Chas Owens
On 8/8/07, Jeff Pang <[EMAIL PROTECTED]> wrote: snip > perl -pi -e '$i++;s/^.*$/something/ if $i==10' your_file snip There is no need to keep track of the number of lines with a separate variable. Perl already does this with the $. variable. Also, a regex that replaces everything is pointless, j

Re: [OT] How do you use Perl?

2007-08-09 Thread Adriano Ferreira
On 8/9/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hello list, > > Just be curious to see how do you guys use Perl for work.Would you be > pleased to give a vote below? > > [a] CGI/Web Development > [b] System Administration > [c] mod_perl -- write Apache handler > [d] write commercial produ

Re: Moving Files, subfolders

2007-08-09 Thread Chas Owens
On 8/8/07, Evyn <[EMAIL PROTECTED]> wrote: > Hi all, > > I have the following perl script that copies files from one folder to > another: > > use File::Copy; > my $filename = 'gar'; > for my $file ( <*.$filename> ) { > # copy each individual file > move($file, "c:\\Documents\\AudioDownloads

Re: Compare two different files.

2007-08-09 Thread Chas Owens
On 8/9/07, Mr. Shawn H. Corey <[EMAIL PROTECTED]> wrote: > Jeff Pang wrote: > > I don't think they can be compared if one is txt type and another isn't. > > Or you can use unix 'diff' command on them but you would get errors. > > The UNIX command `cmp` is used to compare binary files. `diff` is fo

Re: How to read a very large file??

2007-08-09 Thread Chas Owens
On 8/9/07, sivasakthi <[EMAIL PROTECTED]> wrote: snip > > perldoc -f tell > > perldoc -f seek > > http://search.cpan.org/~mgrabnar/File-Tail-0.99.3/Tail.pm > > Thanks for ur suggestionsIn that which method is better solution??? Depends on what you are doing. If the program run continuously th

Re: Moving Files, subfolders

2007-08-09 Thread Mr. Shawn H. Corey
Evyn wrote: Hi all, I have the following perl script that copies files from one folder to another: use File::Copy; my $filename = 'gar'; for my $file ( <*.$filename> ) { # copy each individual file move($file, "c:\\Documents\\AudioDownloadsWaiting\\") or die "move failed: $!"; } pri

Re: Compare two different files.

2007-08-09 Thread Mr. Shawn H. Corey
Jeff Pang wrote: I don't think they can be compared if one is txt type and another isn't. Or you can use unix 'diff' command on them but you would get errors. The UNIX command `cmp` is used to compare binary files. `diff` is for text files. -- Just my 0.0002 million dollars worth, Shaw

Re: How to read a very large file??

2007-08-09 Thread sivasakthi
On Wed, 2007-08-08 at 08:12 -0400, Chas Owens wrote: > On 8/8/07, sivasakthi <[EMAIL PROTECTED]> wrote: > > Hi Guys, > > > > I have a very large file. It may be contain 1lac lines.. also it > > length is increased in dynamically.. > > Each time ( per 5 min) i need to read the contents from file

Re: Range operator

2007-08-09 Thread yaron
Hi Chas and Jeff, Thanks for your detailed answers. From chas answer I understand that this problem is addressed in perl 6. So, I will have to wait a bit In the meanwhile I will have to write my own "smart" flipflop. BFN Yaron Kahanovitch - Original Message - From: "Chas Owens

Re: Range operator

2007-08-09 Thread Chas Owens
On 8/9/07, Jeff Pang <[EMAIL PROTECTED]> wrote: snip > I would like to write it as, > > local $/; > while(<>) { >print $1 if /FROM(.*?)END/s; > } snip I wouldn't like you to write it that way. What if the file is very large? Reading entire files (especially ones where you have no control ove

Re: Range operator

2007-08-09 Thread Chas Owens
On 8/9/07, Chas Owens <[EMAIL PROTECTED]> wrote: snip > This mostly works, but doesn't do the right thing for START inside the range > > #!/usr/bin/perl -n > > print if /START/ .. /END/ and not (/START/ or /END/) > > This works, but doesn't use the filpflop* operator > > #!/usr/bin/perl > > my $in

Re: Range operator

2007-08-09 Thread Chas Owens
On 8/9/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hi, > > In the following example I have to print all the line from line "FROM" till > "END" not including the "FROM" line and the "END" line. > That is if the file consists from the following lines: > > ds > FROM > 1 > 2 > 3 > 34 > 5 > 6 >

Re: Range operator

2007-08-09 Thread Jeff Pang
-Original Message- >From: [EMAIL PROTECTED] >Sent: Aug 9, 2007 3:02 AM >To: beginners >Subject: Range operator > >Hi, > >In the following example I have to print all the line from line "FROM" till >"END" not including the "FROM" line and the "END" line. >That is if the file consists fro

Re: [OT] How do you use Perl?

2007-08-09 Thread Randal L. Schwartz
> "pennyyh" == pennyyh <[EMAIL PROTECTED]> writes: pennyyh> [f] others Write books. Teach. Give presentations at conferences. Annoy people online with corrections to incorrect answers. :) -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 <[EMAIL PROTECTED]>

Range operator

2007-08-09 Thread yaron
Hi, In the following example I have to print all the line from line "FROM" till "END" not including the "FROM" line and the "END" line. That is if the file consists from the following lines: ds FROM 1 2 3 34 5 6 END dsa I would like to print: 1 2 3 34 5 6 I would like to accomplish that with r