Re: how to only read the files last 13 lines

2012-06-11 Thread Shekar
If you are on linux, try command ->tail -13 FILE_NAME -- Shekar On Tue, Jun 12, 2012 at 11:38 AM, lina wrote: > Hi, > > How to read the files last 13 lines, > > only process the data of the last 13 lines, ignore the head parts. > > Thanks with best regards, > > -- > To unsubscribe, e-mail:

Re: how to only read the files last 13 lines

2012-06-11 Thread pangj
How to read the files last 13 lines, only process the data of the last 13 lines, ignore the head parts. Thanks with best regards, Try File::Tail, this is might what you are looking for: use File::Tail; my $file=File::Tail->new(name=>"file.txt", tail=>13); while (defined(my $line=$file->re

how to only read the files last 13 lines

2012-06-11 Thread lina
Hi, How to read the files last 13 lines, only process the data of the last 13 lines, ignore the head parts. Thanks with best regards, -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: Very Sluggish Code

2012-06-11 Thread timothy adigun
Hi GlenM, Please my comments below: On Mon, Jun 11, 2012 at 7:06 PM, GlenM wrote: > Hello Folks; > > I see an earlier post about sluggish code - I am not really sure what I am > doing, so I let me post my entire script here. > > ++ > > #!/usr/bin/

Re: ERROR: Argument isn't numeric

2012-06-11 Thread timothy adigun
Hi John, Please, check my comments below: On Sun, Jun 10, 2012 at 12:23 PM, John M Rathbun wrote: > Hello and thanks for volunteering your time! > > I'm returning to PERL after about a year and am struggling to remaster > some syntax: > > #!/usr/local/bin/perl > use warnings; > use strict; > us

Re: ERROR: Argument isn't numeric

2012-06-11 Thread Zheng Du
Hi John Refer to the comments foreach $i (@dir) { *#$i here refers to each content of your array @dir, which are file names* my @title = split /\./, $dir[$i]; *#$i here refers to the array index, which should be number* $name = $title[0]; print FH "$name\n"; } Zheng 2012/6/10 John M Rathbun >

Re: Very Sluggish Code

2012-06-11 Thread Ken Slater
On Mon, Jun 11, 2012 at 9:36 PM, Ken Slater wrote: > On Mon, Jun 11, 2012 at 2:06 PM, GlenM wrote: >> Hello Folks; >> >> I see an earlier post about sluggish code - I am not really sure what I am >> doing, so I let me post my entire script here. >> >>

Re: Very Sluggish Code

2012-06-11 Thread Ken Slater
On Mon, Jun 11, 2012 at 2:06 PM, GlenM wrote: > Hello Folks; > > I see an earlier post about sluggish code - I am not really sure what I am > doing, so I let me post my entire script here. > > ++ > > #!/usr/bin/perl > > #use strict; > use DBI; > use

Very Sluggish Code

2012-06-11 Thread GlenM
Hello Folks; I see an earlier post about sluggish code - I am not really sure what I am doing, so I let me post my entire script here. ++ #!/usr/bin/perl #use strict; use DBI; use XML::XPath; use XML::XPath::XMLParser; # Set the input dir where

Re: Sluggish code

2012-06-11 Thread John W. Krahn
venkates wrote: Hi all, Hello, I am trying to filter files from a directory (code provided below) by comparing the contents of each file with a hash ref (a parsed id map file provided as an argument). The code is working however, is extremely slow. The .csv files (81 files) that I am reading

Re: Check parameters for a checkbox

2012-06-11 Thread Shawn H Corey
On 12-06-11 03:51 PM, Mark Haney wrote: Here's a portion of the html: M T I thought that the values of each selected checkbox would be passed via the variable name 'DoW' (as in 'MTWTH' or 'MWF'), but that doesn't look like the case. The data is passed to a CGI script that does this before pa

Check parameters for a checkbox

2012-06-11 Thread Mark Haney
This might be the wrong place to post this, but since it's /sort of/ perl related, maybe I'll get some help. I've got a series of checkboxes denoting the days of the week and I want the ones that are checked to be passed to my CGI script from the form. Apparently, I'm not getting the method wh

Re: Sluggish code

2012-06-11 Thread Jim Gibson
On Jun 11, 2012, at 7:31 AM, venkates wrote: > Hi all, > > I am trying to filter files from a directory (code provided below) by > comparing the contents of each file with a hash ref (a parsed id map file > provided as an argument). The code is working however, is extremely slow. > The .csv

Re: Sluggish code

2012-06-11 Thread Liutauras Diu
It's hard to suggest improvement seeing only a fragment of entire code for, but I would probably expect your code to be slow as you have 5 nested for each loops: while ( my @data_files = grep(/\.csv$/,readdir(DH)) ) ... foreach my $file ( @data_files ) ... while ( my $data = <$FH>

Re: how to get a sequence of 01 02 ..

2012-06-11 Thread Shawn H Corey
On 12-06-11 11:04 AM, lina wrote: #!/usr/bin/env perl use strict; use warnings; use autodie qw(open close); use Carp qw(croak); use 5.012; my $tra=7; my @files=("01".."40"); foreach(@files){ $tra=process_onefile("replica_index_$_.xvg"); } sub process_onefile{ my $b

Re: how to get a sequence of 01 02 ..

2012-06-11 Thread lina
On Mon, Jun 11, 2012 at 10:42 PM, Brian Fraser wrote: > On Mon, Jun 11, 2012 at 10:49 AM, lina wrote: >> >> Hi, >> >> >> $  for i in `seq -f '%02g' 1 10` ; do echo $i ; done >> 01 >> 02 >> 03 >> 04 >> 05 >> 06 >> 07 >> 08 >> 09 >> 10 >> >> I wonder how can I get something like above in the perl.

Re: Sluggish code

2012-06-11 Thread Rob Coops
On Mon, Jun 11, 2012 at 4:31 PM, venkates wrote: > Hi all, > > I am trying to filter files from a directory (code provided below) by > comparing the contents of each file with a hash ref (a parsed id map file > provided as an argument). The code is working however, is extremely slow. > The .csv

Re: how to get a sequence of 01 02 ..

2012-06-11 Thread Brian Fraser
On Mon, Jun 11, 2012 at 10:49 AM, lina wrote: > Hi, > > > $ for i in `seq -f '%02g' 1 10` ; do echo $i ; done > 01 > 02 > 03 > 04 > 05 > 06 > 07 > 08 > 09 > 10 > > I wonder how can I get something like above in the perl. > > for my $i ("01".."10") { say $i; }

Sluggish code

2012-06-11 Thread venkates
Hi all, I am trying to filter files from a directory (code provided below) by comparing the contents of each file with a hash ref (a parsed id map file provided as an argument). The code is working however, is extremely slow. The .csv files (81 files) that I am reading are not very large (l

Re: how to get a sequence of 01 02 ..

2012-06-11 Thread Shlomi Fish
Hi, On Mon, 11 Jun 2012 07:10:07 -0700 "Ron Bergin" wrote: > >lina wrote: > > Hi, > > > > > > $ for i in `seq -f '%02g' 1 10` ; do echo $i ; done > > 01 > > 02 > > 03 > > 04 > > 05 > > 06 > > 07 > > 08 > > 09 > > 10 > > > > I wonder how can I get something like above in the perl. > > > perl -e

Re: how to get a sequence of 01 02 ..

2012-06-11 Thread Ron Bergin
>lina wrote: > Hi, > > > $ for i in `seq -f '%02g' 1 10` ; do echo $i ; done > 01 > 02 > 03 > 04 > 05 > 06 > 07 > 08 > 09 > 10 > > I wonder how can I get something like above in the perl. > perl -e "for (1..10){printf(qq(%02d\n), $_)}" Ron -- To unsubscribe, e-mail: beginners-unsubscr...@perl.

RE: how to get a sequence of 01 02 ..

2012-06-11 Thread Jack Maney
How about: use strict; use warnings; foreach my $i(1..10){$i="0" . $i if length($i)==1;print "$i\n";} -Original Message- From: lina [mailto:lina.lastn...@gmail.com] Sent: Monday, June 11, 2012 8:49 AM To: beginners@perl.org Subject: how to get a sequence of 01 02 .. Hi, $ for i in `s

how to get a sequence of 01 02 ..

2012-06-11 Thread lina
Hi, $ for i in `seq -f '%02g' 1 10` ; do echo $i ; done 01 02 03 04 05 06 07 08 09 10 I wonder how can I get something like above in the perl. Thanks ahead for your suggestions, Best regards, -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginner

ERROR: Argument isn't numeric

2012-06-11 Thread John M Rathbun
Hello and thanks for volunteering your time! I'm returning to PERL after about a year and am struggling to remaster some syntax: #!/usr/local/bin/perl use warnings; use strict; use diagnostics; # Converts current directory to a list of links my @dir; my $name; my $i = 0; opendir DH, "." or