Re: perl sort

2009-02-07 Thread Raymond Wan
Hi all, Chas. Owens wrote: Well, I would suggest taking this to the Perl Porters list*, this is a list for people who are starting to learn Perl. You could also write a module implementing you algorithm either in pure Perl or in XS** (the interface between ISO C and Perl) and upload it to CPAN

Re: perl sort

2009-02-07 Thread Chas. Owens
On Sat, Feb 7, 2009 at 22:41, Marion McCoskey wrote: > I am a retired programmer, and I haven't had a lot of trouble with the > couple of thousand lines of Perl I have written, except remembering to > always put in curly braces. But I don't know anything about the Perl > community. > > While look

Re: perl sort

2009-02-07 Thread Raymond Wan
Hi Marion, Marion McCoskey wrote: While looking at the documentation for the sort function, I noticed it complaining about the shortcomings of the quick sort. I share that feeling and I have developed a single-buffered count sort that is faster than the quick sort and a lot more stable. Act

perl sort

2009-02-07 Thread Marion McCoskey
I am a retired programmer, and I haven't had a lot of trouble with the couple of thousand lines of Perl I have written, except remembering to always put in curly braces. But I don't know anything about the Perl community. While looking at the documentation for the sort function, I noticed it comp

Re: Regular Expressions

2009-02-07 Thread Chas. Owens
On Sat, Feb 7, 2009 at 19:11, Gunnar Hjalmarsson wrote: > Chas. Owens wrote: >> >> On Sat, Feb 7, 2009 at 16:09, Gunnar Hjalmarsson >> wrote: >>> >>> Chas. Owens wrote: This isn't a job for a regex; it is a job for split: >>> >>> whose first argument is a regex pattern... ;-) >> >> snip

Re: Regular Expressions

2009-02-07 Thread Chas. Owens
On Sat, Feb 7, 2009 at 19:21, Rob Dixon wrote: snip > $record =~ s|,(..)/(..)/(),|,$3$1$2,| or die "Data problem"; snip Yes, but how would you handle it if this weren't the second field? It is better to have a general solution. -- Chas. Owens wonkden.net The most important skill a program

Re: Regular Expressions

2009-02-07 Thread Rob Dixon
Chas. Owens wrote: > On Sat, Feb 7, 2009 at 08:45, Soham Das wrote: >> Hi All, >> >> I am a noob in Perl and hence would like some help to what I am sure is a >> very easy problem. >> >> I have got a text file in csv format >> The format is: >> ,,, >> >> Now my objective is to change the for

Re: Regular Expressions

2009-02-07 Thread Gunnar Hjalmarsson
Chas. Owens wrote: On Sat, Feb 7, 2009 at 16:09, Gunnar Hjalmarsson wrote: Chas. Owens wrote: This isn't a job for a regex; it is a job for split: whose first argument is a regex pattern... ;-) snip Yes and a regex follows in the substitute, but the whole things isn't being done with a rege

Re: Regular Expressions

2009-02-07 Thread Chas. Owens
On Sat, Feb 7, 2009 at 16:09, Gunnar Hjalmarsson wrote: > Chas. Owens wrote: >> >> This isn't a job for a regex; it is a job for split: > > whose first argument is a regex pattern... ;-) snip Yes and a regex follows in the substitute, but the whole things isn't being done with a regex. Trying to

Re: Regular Expressions

2009-02-07 Thread Gunnar Hjalmarsson
Chas. Owens wrote: This isn't a job for a regex; it is a job for split: whose first argument is a regex pattern... ;-) -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...

Re: bash in perl

2009-02-07 Thread Owen
> Hello, > > I try to write the name of the current directory in $x: > > $x = system ("pwd"); > > But it doesn't work. It also doesn't work in all these combinations:  > $x = 'system("pwd")'; > $x = system("`pwd`"); > > Can You help me to write the result of 'pwd' in $x? Where is 'pwd'?

Re: bash in perl

2009-02-07 Thread oryann9
- Original Message From: pouliakhina To: beginners@perl.org Sent: Saturday, February 7, 2009 8:59:56 AM Subject: bash in perl Hello, I try to write the name of the current directory in $x: $x = system ("pwd"); But it doesn't work. It also doesn't work in all these combinations:  $x =

Re: bash in perl

2009-02-07 Thread Chas. Owens
On Sat, Feb 7, 2009 at 08:59, pouliakhina wrote: > Hello, > > I try to write the name of the current directory in $x: > > $x = system ("pwd"); > > But it doesn't work. It also doesn't work in all these combinations: >  > $x = 'system("pwd")'; > $x = system("`pwd`"); > > Can You help me to write

Re: Regular Expressions

2009-02-07 Thread Chas. Owens
On Sat, Feb 7, 2009 at 08:45, Soham Das wrote: > Hi All, > > I am a noob in Perl and hence would like some help to what I am sure is a > very easy problem. > > I have got a text file in csv format > The format is: > ,,, > > Now my objective is to change the format of the date, and rename the

bash in perl

2009-02-07 Thread pouliakhina
Hello, I try to write the name of the current directory in $x: $x = system ("pwd"); But it doesn't work. It also doesn't work in all these combinations:  $x = 'system("pwd")'; $x = system("`pwd`"); Can You help me to write the result of 'pwd' in $x? Thank You, Irina -- To unsubscribe, e

Re: RegEx to extract last character of a line

2009-02-07 Thread Chas. Owens
On Sat, Feb 7, 2009 at 07:10, John W. Krahn wrote: > Rob Dixon wrote: >> >> Greg wrote: >>> >>> I have an input file that I have to evaluate whether to include lines >>> based upon their last character. >>> Is there a simple regex that would allow me to >>> assign the very last character to a vari

Regular Expressions

2009-02-07 Thread Soham Das
Hi All, I am a noob in Perl and hence would like some help to what I am sure is a very easy problem. I have got a text file in csv format The format is: ,,, Now my objective is to change the format of the date, and rename the whole file as a .csv So, my strategy is: I want to read the co

Re: Regarding automation of file transfer

2009-02-07 Thread Chas. Owens
On Fri, Feb 6, 2009 at 13:27, jk wrote: > i m a beginner to perl . i want to write a perl program to Connect to > an FTP server and get or put files and also to Automate the one-time > transfer of many files to download the file everyday, which have > changed since yesterday. i have written the fi

Re: ending a character to each line

2009-02-07 Thread sf
On Feb 5, 6:09 pm, jwkr...@shaw.ca (John W. Krahn) wrote: > stuforman wrote: > > i want to use perl to end each line with a '~'. i would really > > appreciate any syntax that would help me do this... > > $line =~ s/$/~/; > > John > -- > Those people who think they know everything are a great > anno

Re: rsh shell command hangs and does not return

2009-02-07 Thread Chas. Owens
On Sat, Feb 7, 2009 at 07:17, Chas. Owens wrote: > On Fri, Feb 6, 2009 at 14:31, Ice Man wrote: >> Ok . so I have to start a program which is written in java. >> >> #!/local/bin/perl >> >> my $command = "/aa/bb/c/executable \&"; >> my $ret = 0; >> >> $ret = `$command`; >> >> exit $ret; >> >>

Re: rsh shell command hangs and does not return

2009-02-07 Thread Chas. Owens
On Fri, Feb 6, 2009 at 14:31, Ice Man wrote: > Ok . so I have to start a program which is written in java. > > #!/local/bin/perl > > my $command = "/aa/bb/c/executable \&"; > my $ret = 0; > > $ret = `$command`; > > exit $ret; > > The normal behavior of this executable is to list some informati

Re: RegEx to extract last character of a line

2009-02-07 Thread John W. Krahn
Rob Dixon wrote: Greg wrote: I have an input file that I have to evaluate whether to include lines based upon their last character. Is there a simple regex that would allow me to assign the very last character to a variable? ^^^ ^^^

Re: RegEx to extract last character of a line

2009-02-07 Thread John W. Krahn
Greg wrote: I have an input file that I have to evaluate whether to include lines based upon their last character. Is there a simple regex that would allow me to assign the very last character to a variable? In my case it will either be A or I (capital i) if that helps? /([AI])\z/ and my $vari

Re: how to print % when using printf

2009-02-07 Thread Dr.Ruud
itshardtogetone wrote: > How do I print the % sign when using printf. RTFM. See for example: perldoc -f printf, which should point you to the sprintf doc. It is even the first mentioned conversion there. The doc is on a thingy called "the web" too: http://perldoc.perl.org/functions/sprintf.html

Re: Help matching with Regular expression

2009-02-07 Thread Rob Dixon
Jim wrote: > > How do I match a line ending in > ,@@) > using a regular expression? my $line = "1234567890,@@)\n"; if ($line =~ m/,@@\)$/) { print "OK\n"; } HTH, Rob -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://lea

Re: RegEx to extract last character of a line

2009-02-07 Thread Rob Dixon
Greg wrote: > > I have an input file that I have to evaluate whether to include lines > based upon their last character. > Is there a simple regex that would allow me to assign the very last > character to a variable? > > In my case it will either be A or I (capital i) if that helps? > > Thanks v

java hangs from perl

2009-02-07 Thread Ice Man
ok . trying this again. Seems my first post did not take so I will try again. I need to start a java program. So in perl, I have created a command like: my $command = "executable \&"; my $ret = `$command`; exit $ret; This program does not return but rather hangs. If I try this in linux fr

Help matching with Regular expression

2009-02-07 Thread Jim
How do I match a line ending in ,@@) using a regular expression? Thank you -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Regarding automation of file transfer

2009-02-07 Thread jk
i m a beginner to perl . i want to write a perl program to Connect to an FTP server and get or put files and also to Automate the one-time transfer of many files to download the file everyday, which have changed since yesterday. i have written the first part of the program i.e.connect,get and put f

rsh shell command hangs and does not return

2009-02-07 Thread Ice Man
Ok . so I have to start a program which is written in java. #!/local/bin/perl my $command = "/aa/bb/c/executable \&"; my $ret = 0; $ret = `$command`; exit $ret; The normal behavior of this executable is to list some information but it never returns you to a prompt. You have to hit the ret

RegEx to extract last character of a line

2009-02-07 Thread Greg
I have an input file that I have to evaluate whether to include lines based upon their last character. Is there a simple regex that would allow me to assign the very last character to a variable? In my case it will either be A or I (capital i) if that helps? Thanks very much from a perl newb. -G