Re: close file if it's open

2012-08-27 Thread lina
Thanks Jim and John. btw, what does the fileno mean? mean file-not-open? -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

close file if it's open

2012-08-27 Thread lina
Hi, I don't know which is the best way to "check whether this file is open or not," Here it what I came out so far, #!/usr/bin/env perl use strict; use warnings; use autodie qw(open close); use 5.012; my $fn = "new_30.pdb"; open my $fh, '<', $fn; my $ofh; while(my $line = <$fh>){ i

Re: How to do ssh connection from client-to-remote machine1-to-remote machine2-to-remote machine3 and execute command on remote machine3

2012-08-24 Thread lina
On Friday 24,August,2012 07:28 PM, Sasikanth Eda wrote: > Hi All, > > I am working on an automation scenario, where the steps mentioned below are > to be performed; > > 1. Script has to run on client machine. > > 2. Using the Perl script on client machine, we need to login to remote > machine-1

Re: extract blocks out and output into a series of files

2012-08-22 Thread lina
On Thursday 23,August,2012 12:46 AM, Jim Gibson wrote: > > On Aug 22, 2012, at 8:32 AM, lina wrote: > >> Hi, >> >> I have a data file, wish to split into 9 small files, each one starts >> >> >> 2:MODEL1 >> 1552:ENDMDL >> >&g

extract blocks out and output into a series of files

2012-08-22 Thread lina
Hi, I have a data file, wish to split into 9 small files, each one starts 2:MODEL1 1552:ENDMDL 1554:MODEL2 3104:ENDMDL 3106:MODEL3 4656:ENDMDL till 12418:MODEL9 13968:ENDMDL The left number are the line numbers. I can get those 9 output file via some sed co

Re: subroutines only return once

2012-07-29 Thread lina
On Sun, Jul 29, 2012 at 11:19 PM, Andy Bach wrote: > On Sun, Jul 29, 2012 at 10:01 AM, lina wrote: >> Strangely, it only substituted once, but not for the later once. >> Thanks ahead for your suggestions, I don't know why, > > Not exactly sure what you're up to -

subroutines only return once

2012-07-29 Thread lina
Hi, I have written something as following, my $template_file="template"; my $h_data_file="h_data"; open my $fh1, '<', $template_file; open my $fh2, '<', $h_data_file; while(<$fh2>){ my ($h11,$h21,$h22,$h33)=split ' ', $_; &substitute($h11,$h21,$h22,$h33); say $h11,$h21

Re: Something mojolicious

2012-07-05 Thread lina
On Thu, Jul 5, 2012 at 7:14 PM, Octavian Rasnita wrote: > Have you tried localhost:3000 or the correct URL http://localhost:3000 ? Yes. I tried again. > > --Octavian > > - Original Message - > From: "lina" > To: > Sent: Thursday, July 05, 2012 1:03 P

Re: Something mojolicious

2012-07-05 Thread lina
On Thu, Jul 5, 2012 at 6:18 PM, David Precious wrote: > On Thu, 5 Jul 2012 18:03:07 +0800 > lina wrote: > >> But on my two webbrowers when I tried localhost:3000 it failed to >> open. > > As in connection failed, or gave some other error? Hi, It shows T

Re: Something mojolicious

2012-07-05 Thread lina
Furthermore, Host is up. Other addresses for localhost (not scanned): 127.0.0.1 PORT STATESERVICE 3000/tcp filtered ppp Thanks, -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Something mojolicious

2012-07-05 Thread lina
Hi, Today I tried to write my first hello script, $ mojo generate lite_app hello vim hello to the following: get '/' => sub { my $self = shift; $self->render_text('Hello!'); }; $ morbo hello [Thu Jul 5 17:49:39 2012] [info] Listening at "http://*:3000";. Server available at http://127.0.

MySQL and Perl

2012-07-02 Thread lina
Hi, Is this book old? http://www.kitebird.com/mysql-perl/ MySQL and Perl for the Web 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: how to transform xyz into matrix

2012-06-29 Thread lina
On Sat, Jun 30, 2012 at 12:21 AM, John W. Krahn wrote: > lina wrote: >> >> On Thu, Jun 28, 2012 at 4:44 PM, John W. Krahn  wrote: >>> >>> lina wrote: >>>> >>>> >>>> I have some data like: >>>> >>>> 0.3

Re: how to transform xyz into matrix

2012-06-29 Thread lina
On Fri, Jun 29, 2012 at 10:10 PM, Jim Gibson wrote: > > On Jun 29, 2012, at 6:09 AM, lina wrote: >>> >>>> I have some data like: >>>> >>>> 0.35 3.41 1 >>>> 0.35 4.24 1 >>>> 0.35 4.35 2 >>>> 0.36 0.36 1 >

Re: how to transform xyz into matrix

2012-06-29 Thread lina
On Thu, Jun 28, 2012 at 4:44 PM, John W. Krahn wrote: > lina wrote: >> >> Hi, > > > Hello, > > >> I have some data like: >> >> 0.35 3.41 1 >> 0.35 4.24 1 >> 0.35 4.35 2 >> 0.36 0.36 1 >> 0.36 1.32 1 >> 0.36 1.45 1 >

Re: how to transform xyz into matrix

2012-06-28 Thread lina
On Thu, Jun 28, 2012 at 4:44 PM, John W. Krahn wrote: > lina wrote: >> >> Hi, > > > Hello, > > >> I have some data like: >> >> 0.35 3.41 1 >> 0.35 4.24 1 >> 0.35 4.35 2 >> 0.36 0.36 1 >> 0.36 1.32 1 >> 0.36 1.45 1 >

Re: how to transform xyz into matrix

2012-06-28 Thread lina
On Thu, Jun 28, 2012 at 3:41 PM, lina wrote: > Hi, > > I have some data like: > > 0.35 3.41 1 > 0.35 4.24 1 > 0.35 4.35 2 > 0.36 0.36 1 > 0.36 1.32 1 > 0.36 1.45 1 > 0.36 1.46 1 > > > wish the output look like > >       0.36 1.32 1.45 1.46  3.41

how to transform xyz into matrix

2012-06-28 Thread lina
Hi, I have some data like: 0.35 3.41 1 0.35 4.24 1 0.35 4.35 2 0.36 0.36 1 0.36 1.32 1 0.36 1.45 1 0.36 1.46 1 wish the output look like 0.36 1.32 1.45 1.46 3.41 4.24 4.35 0.35 0 0 0 0 11 2 0.36 1 1 1 1 00 0 Thanks ahead fo

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: 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 >&g

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

Re: how to print certain field out

2012-06-08 Thread lina
On Sat, Jun 9, 2012 at 12:16 AM, lina wrote: > Hi, > > Here is the to-be-processed file, > > $ more try >  #  RESIDUE AA STRUCTURE BP1 BP2  ACC     N-H-->O    O-->H-N > N-H-->O    O-->H-N    TCO  KAPPA ALPHA  PHI   PSI    X-CA   Y-CA > Z-CA >    1  174

how to print certain field out

2012-06-08 Thread lina
Hi, Here is the to-be-processed file, $ more try # RESIDUE AA STRUCTURE BP1 BP2 ACC N-H-->OO-->H-N N-H-->OO-->H-NTCO KAPPA ALPHA PHI PSIX-CA Y-CA Z-CA 1 174 V 0 00 0, 0.0 2,-0.3 0, 0.0 0, 0.0 0.000 360.0 360.0 360.0 137.8

Re: refine the code

2012-06-06 Thread lina
On Wed, Jun 6, 2012 at 1:45 AM, Shlomi Fish wrote: > Hi Lina, > > On Tue, 5 Jun 2012 16:03:52 +0800 > lina wrote: > >> Hi, >> >> I wrote one, but don't know make it mature. >> > > Overall, your program is OK, but see below for my nitpicks. >

refine the code

2012-06-05 Thread lina
Hi, I wrote one, but don't know make it mature. Here is what I am going to do. "43 43 40 1", "A c #FF " /* "0" */, "B c #F8F8F8 " /* "0.0385" */, "C c #F2F2F2 " /* "0.0769" */, "D c #EBEBEB " /* "0.115" */, "E c #E5E5E5 " /* "0.154" */, "F c #DEDEDE " /* "0.192" */, "G c #D8D8D8 " /

Re: insert

2012-05-07 Thread lina
On Mon, May 7, 2012 at 7:52 PM, Shawn H Corey wrote: > On 12-05-07 03:36 AM, lina wrote: >> >> How can I insert the first file into the middle of the second file, > > > What code have you tried so far and please provide the expected output for > your example. >

insert

2012-05-07 Thread lina
Hi, I have two files, one with 3 2 1 another is: 3 1 3 2 6 3 How can I insert the first file into the middle of the second file, Thanks ahead for your suggestions, Best regards, -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.o

Re: how to get two matches out

2012-04-29 Thread lina
Thanks for Lawrence's crystal clear explaination and Shawn's reply. I understand now, best regards, P.S seems we don't have the same perldoc. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: how to get two matches out

2012-04-29 Thread lina
On Sun, Apr 29, 2012 at 11:26 PM, Lawrence Statton wrote: > On 04/29/2012 10:21 AM, lina wrote: >> >> Hi, >> >> I have a text file like: >> >> $ more sample.tex >> >> aaa \cite{d1,d2},ddd \cite{e1},ccc \cite{f1,f2,f3} >> bbb\cite{i

how to get two matches out

2012-04-29 Thread lina
Hi, I have a text file like: $ more sample.tex aaa \cite{d1,d2},ddd \cite{e1},ccc \cite{f1,f2,f3} bbb\cite{inhibitor}aaa sub read_tex{ open my $fh, '<', @_; while(<$fh>){ if(/cite\{(.+?)\}/){ push @citeditems,split/,/,$1; }

Re: translate following files based on the last line of the previous file

2012-04-23 Thread lina
On Monday 23,April,2012 09:28 PM, lina wrote: On Monday 23,April,2012 01:27 AM, Jim Gibson wrote: On Apr 22, 2012, at 9:52 AM, lina wrote: Here is what I Have came up so far, #!/usr/bin/env perl use strict; use warnings; use autodie qw(open close); use 5.012; my $dict = system("tail

how to quick print a series of *

2012-04-23 Thread lina
Hi, suppose I wish to print 20 * seems print "*{20}" not work. Thanks ahead for your sugestions, Best regards, -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: translate following files based on the last line of the previous file

2012-04-23 Thread lina
On Monday 23,April,2012 01:27 AM, Jim Gibson wrote: On Apr 22, 2012, at 9:52 AM, lina wrote: Here is what I Have came up so far, #!/usr/bin/env perl use strict; use warnings; use autodie qw(open close); use 5.012; my $dict = system("tail -n 1 text_1.xvg"); Read the documentat

translate following files based on the last line of the previous file

2012-04-22 Thread lina
Hi, I have a series of files. $ cat text_1.xvg 0 0 1 2 3 2 1 0 2 3 4 1 2 0 3 $ cat text_2.xvg 0 0 1 2 3 2 1 0 3 2 4 1 3 0 2 I wish to translate the text_2 numbers (except the first field) based on the last line of the text_1.xvg namely text_2.xvg will be

Re: get information from server

2012-04-22 Thread lina
On Sunday 22,April,2012 06:20 AM, David Christensen wrote: On 04/21/2012 07:51 AM, lina wrote: Thanks, I didn't realize that the ssh p3600 'do something' can do something without being in the server. Yes -- providing a command to ssh is a very useful. Check out the manua

Re: get information from server

2012-04-21 Thread lina
On Saturday 21,April,2012 02:42 AM, David Christensen wrote: On 04/20/2012 05:42 AM, lina wrote: I used to ssh Mars (servers's name) and then cd to some directory and check some file's modification time. Can I do it locally with perl, without ssh? A local Perl script will need s

get information from server

2012-04-20 Thread lina
Hi, I used to ssh Mars (servers's name) and then cd to some directory and check some file's modification time. Can I do it locally with perl, without ssh? What I came so far is equal to null, but I am still google-ing. Thanks ahead for your suggestions or template that I can work on. Best r

Re: split

2012-04-04 Thread lina
On Wed, Apr 4, 2012 at 8:57 PM, Anamika K wrote: > Hello All, > I have a file like this: > > > NM_009648,NM_001042541:1        0.955794504181601 > NM_019584:1     0.900900900900901 > NM_198862:1     0.835755813953488 > NM_001039093,NM_001039092,NM_153080:1   0.805008944543828 > > and want output l

localtime output result

2012-04-02 Thread lina
Hi, I am so confused the time output result. Time::tm=ARRAY(0x109c3b0) Here is the code: #!/usr/bin/env perl use strict; use warnings; use autodie qw(open close); use 5.012; use Time::localtime; use File::stat; open my $fh, '<', "too0.tex"; my $time = localtime; my $modtime = ctime(stat($f

Re: how to check new file generated

2012-04-02 Thread lina
On Mon, Apr 2, 2012 at 11:35 PM, Jim Gibson wrote: > At 4:08 PM +0800 4/2/12, lina wrote: >> >> I wish there is an alternative way in linux without installing use >> Mail::Sendmail; >> >> on bash I used >> >> mail lina.lastn...@gmail.com < repor

Re: send email by /usr/bin/mail

2012-04-02 Thread lina
On Mon, Apr 2, 2012 at 9:34 PM, Shawn H Corey wrote: > On 12-04-02 09:17 AM, lina wrote: >> >> Thanks ahead for any suggestions > > > Have you tried searching CPAN for "mail"? http://search.cpan.org/ This short script is planned to use in remote server to che

send email by /usr/bin/mail

2012-04-02 Thread lina
Hi, I don't know how to send email in perl with /usr/bin/mail Thanks ahead for any suggestions Best regards, -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: how to check new file generated

2012-04-02 Thread lina
I wish there is an alternative way in linux without installing use Mail::Sendmail; on bash I used mail lina.lastn...@gmail.com < report.txt Thanks, On Mon, Apr 2, 2012 at 4:07 PM, lina wrote: > Thanks now better. Just the send email still not work. With > Mail::Sendmail

Re: how to check new file generated

2012-04-02 Thread lina
Thanks now better. Just the send email still not work. With Mail::Sendmail installed. sendmail( From=> 'lina.lastn...@gmail.com', To => 'lina.lastn...@gmail.com', Subject => 'Step coming close', Message => "Dangerous", ); Do I need set up something extra? > > > > John > -

how to check new file generated

2012-04-02 Thread lina
Hi, At some directory, I wish to check are there some new file generated with step* if no new generated, I wish it sleep for a while if there are some new files generated, I wish it to send am email to myself. Here is what I have came up so far, #!/usr/bin/env perl use strict; use warnings;

Re: hey need hep on this please

2012-03-29 Thread lina
On Thu, Mar 29, 2012 at 6:08 PM, John W. Krahn wrote: > my wrote: >> >> The goal of this assignment is to put in practice the list and I/O >> functionalities implemented by Perl. >> >> >> >> Write a program that will read a list from a file (input), will sort >> the list in lexical order and write

Re: hey need hep on this please

2012-03-29 Thread lina
#!/usr/bin/env perl use strict; use warnings; use autodie qw(open close); use 5.012; open my $fh, '<', '/etc/passwd'; open my $fh2, '>', '/tmp/newpasswd'; my $uid; my %h; while(<$fh>){ $uid = (split /\:/, $_)[0]; $h{$uid} = $_; } print $fh2 map "$h{$_}", sort keys %h;

perl match

2012-03-25 Thread lina
Hi, For Rissman, R.; Poon, W. W.; Blurton, M.; Oddo, S.; Torp, R. I wish to get the output as R. Risman and W. W. Pooon and M. Blurtoon and S. Oddoo and R. Toorp, R. Here is the code I came up so far, which works partially #!/usr/bin/env perl use strict; use warnings; use 5.012; my $str=$

Re: some suggestions

2012-03-22 Thread lina
On Fri, Mar 23, 2012 at 10:20 AM, John W. Krahn wrote: > John W. Krahn wrote: >> >> >> $ echo "Hr 12 >> 0001 2 >> 0002 3 >> 0003 1 >> Hr 13 >> 0001 2 >> 0002 3 >> 0003 1 >> Hr 14 >> 0001 2 >> 0002 3 >> 0003 1" | perl -e' >> >> my ( @hours, %data ); >> while ( <> ) { >>    push @hours, $1 if /^hr\s

Re: how to constitute some value based on the possible abbrevation

2012-03-21 Thread lina
> Thanks for all of you. > > my %abbrev; > > open my $fh, '<', 'try.txt'; > > > while(my $line = <$fh>) { >  chomp $line; >  my $abbr = join '', $line =~ /[A-Z]/g; >  $abbrev{$abbr} = $line; Here I changed it to$abbrev{$line} = $abbre; > } > > use Data::Dumper; > print Data::Dumper->Dump([\%

how to constitute some value based on the possible abbrevation

2012-03-21 Thread lina
Hi, For the following keys, I wish the values to be the abbreviation of them, Nat. Neurosci. Expert Reviews in Molecular Medicine. Intermolecular Forces Nature Cell Biol. CNS Neurol Disord Drug Targets Nat. Rev. Mol. Cell Biol. I came up one, not working though, #!/usr/bin/env perl use strict

Re: swap keys and values

2012-03-21 Thread lina
ail I realize this. Best regards, > > -- > Regards. > > > On 21.03.2012 17:00, lina wrote: >> >> Hi, >> >> I tried to write something, but chocked in the end, >> >> Thanks ahead for your advice, >> >> #!/usr/bin/env perl >&g

swap keys and values

2012-03-21 Thread lina
Hi, I tried to write something, but chocked in the end, Thanks ahead for your advice, #!/usr/bin/env perl use strict; use warnings; my %h = ( 1 => "a", 2 => "b", 3 => "c" ); foreach my $key ( sort keys %h){ $h{$h{$key}}=$key; delete $h{$key}; }

Re: How can I extract the lines after A

2012-03-14 Thread lina
> > Use the range operator to delimit the section you want to extract. > You can read about in 'perldoc perlop' > > if ($line =~ /^A$/ .. $line =~ /^C$/) { Hi, I came back to this again, last time tried to match all under A, like A 1 1 3 1 B 1 3 1 5 A 1 1 Here what if I wish it only meet once A

Please help me polish the code

2012-03-14 Thread lina
strict; use warnings; use Carp qw(croak); use autodie qw(open close); use File::Basename; use List::MoreUtils qw(uniq); croak "Usage: ./bibextract.pl tex_file.tex" unless defined $ARGV[0]; my $infile = $ARGV[0]; my $tex_file = $infile; #my $bib_filename = "/home/lina/texmf/bibtex/b

Re: How to end a loop

2012-03-14 Thread lina
=~ m/@_\,/ .. $line =~ /^\}$/){ print $line; #last; } } close($fh2); } but when I used the sub match{ my $reg = @_; if ($line =~ m/$reg\,/ .. $line =~ /^\}$/){ not works. do you know why? Thanks, On Wed, Mar 14, 2012 at 6

Re: How to end a loop

2012-03-14 Thread lina
## read the .bib database and extract the cited out open my $fh2, '<', $bib_filename; foreach $item (@citeditems){ match($item); } sub match{ my $reg = @_; LINE: while(my $line = <$fh2>){ if ($line =~ m/$reg\,/ .. $line =~ /^\}$/){

Re: How to put the match in an array

2012-03-14 Thread lina
Hi Tim, On Wed, Mar 14, 2012 at 6:03 PM, timothy adigun <2teezp...@gmail.com> wrote: > Hi lina, > > On Wed, Mar 14, 2012 at 10:50 AM, lina wrote: >> >> Hi, >> >> I have problem putting the match into an array, >> >> $ more sample.

How to put the match in an array

2012-03-14 Thread lina
Hi, I have problem putting the match into an array, $ more sample.tex aaa\cite{dehydron,dehydron1},ddd bbb\cite{inhibitorAromaticDirect}aaa open my $fh, '<', "sample.tex"; while(<$fh>){ if(/cite\{(\S+)\}/){ $cited = sprintf "%s\n",$1; #$cited =~ tr/\,/\n/

Re: How to end a loop

2012-03-14 Thread lina
b_filename = "/home/lina/texmf/bibtex/bib/biophymd.bib"; my $bib_filename = "try.bib"; my $bib_abbrev_filename = "/home/lina/texmf/bibtex/bib/biophyabbrev.bib"; my $extracted_bib = "basename($infile).bib"; my $cited; my @citeditems; my $item; ## read all the cited

Re: How to end a loop

2012-03-14 Thread lina
open my $fh, '<', $tex_file; while(<$fh>){ if(/cite\{(\S+)\}/){ $cited = sprintf "%s\n",$1; $cited =~ tr/\,/\n/; push(@citeditems,$cited); } } close($fh); ## read the .bib database and extract the cited out open my $fh2, '<',

Re: How to end a loop

2012-03-14 Thread lina
I updated a bit to sr/bin/env perl use strict; use warnings; use Carp qw(croak); use autodie qw(open close); use File::Basename; croak "Usage: ./bibextract.pl tex_file.tex" unless defined $ARGV[0]; my $infile = $ARGV[0]; my $tex_file = $infile; #my $bib_filename = "/home/lina/t

how to extract one block out

2012-03-13 Thread lina
Hi, Here I have ...some blocks ... @article{Bi07_chen, author = {Chen, J. P. and Zhang, X. and Fernandez, A.}, journal = BIOINFOR, volume = {23}, number = {5}, pages = {563-572}, year = {2007} } @article{MP08_Crespo, author = {Crespo, A. and Fernandez, A.}, journal = MO

How to end a loop

2012-03-13 Thread lina
e = "/home/lina/texmf/bibtex/bib/biophymd.bib"; my $bib_abbrev_filename = "/home/lina/texmf/bibtex/bib/biophyabbrev.bib"; my $extracted_bib = "basename($infile).bib"; my $cited; ## read all the cited items from .tex file and save it to $cited open my $fh, '<&

Re: How can I extract the lines after A

2012-03-11 Thread lina
On Mon, Mar 12, 2012 at 12:11 AM, Zheng Du wrote: > Hi Lina, > > A simple solution I can provide is: > > > > while (my $line = <$fh>){ >        if ($line =~ /^A$/){ >                # read 8 lines >                # print each line >        } Thanks, it&

Re: How can I extract the lines after A

2012-03-11 Thread lina
On Sun, Mar 11, 2012 at 11:15 PM, Ron Bergin wrote: > lina wrote: >> On Sun, Mar 11, 2012 at 10:45 PM, lina wrote: >>> A >>> 7.803481E-01   8.228973E-01   7.515242E-01    2      1833 >>> -5.50     308.3889771284     5   0   7     1.7084151661 >

Re: How can I extract the lines after A

2012-03-11 Thread lina
On Sun, Mar 11, 2012 at 10:45 PM, lina wrote: > A > 7.803481E-01   8.228973E-01   7.515242E-01    2      1833 > -5.50     308.3889771284     5   0   7     1.7084151661 > 1.6790503987       2.75458 > 53558 >  7.866901E-01   8.410519E-01   9.981456E-01    2     144

How can I extract the lines after A

2012-03-11 Thread lina
A 7.803481E-01 8.228973E-01 7.515242E-012 1833 -5.50 308.3889771284 5 0 7 1.7084151661 1.6790503987 2.75458 53558 7.866901E-01 8.410519E-01 9.981456E-012 14485 -5.50 269.620127126039 4 7-2.5561279716 -3.5975355928

beginners@perl.org

2012-03-08 Thread lina
On Thu, Mar 8, 2012 at 10:14 PM, lina wrote: > On Thu, Mar 8, 2012 at 10:07 PM, Shawn H Corey wrote: >> On 12-03-07 11:49 PM, lina wrote: >>> >>> I only read till 15 pages, progressed so slow, and sometimes choked by >>> understanding the "pack&qu

beginners@perl.org

2012-03-08 Thread lina
On Thu, Mar 8, 2012 at 10:07 PM, Shawn H Corey wrote: > On 12-03-07 11:49 PM, lina wrote: >> >> I only read till 15 pages, progressed so slow, and sometimes choked by >> understanding the "pack". really hard for me to understand it, so I >> just skip.  meanwhi

beginners@perl.org

2012-03-07 Thread lina
On Thu, Mar 8, 2012 at 12:40 PM, David Christensen wrote: > On 03/07/2012 08:41 AM, lina wrote: >> $ ./substr_accessing_examples.pl >> Undefined subroutine&main::subst called at >> ./substr_accessing_examples.pl line 15. > > > On 03/07/2012 09:02 AM, Brock

beginners@perl.org

2012-03-07 Thread lina
Thanks for all, I was so inexperience, thought might some module missing and a bit carelessly. Best regards, -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

beginners@perl.org

2012-03-07 Thread lina
Hi, $ ./substr_accessing_examples.pl Undefined subroutine &main::subst called at ./substr_accessing_examples.pl line 15. #!/usr/bin/env perl use strict; use warnings; # # get a 5-byte string, skip 3 bytes, # then grab two 8-byte strings, then the rest; # # (my $leading, my $s1, my $s2, my $tra

Re: strict subs" in use at -e line 1.

2012-03-06 Thread lina
On Tue, Mar 6, 2012 at 11:42 PM, Paul Johnson wrote: > On Tue, Mar 06, 2012 at 11:31:59PM +0800, lina wrote: >> $ perl -Mstrict -wle '{my $char = chr(Ox394) ; print $char;}' >> >> Bareword "Ox394" not allowed while "strict subs" in use at -e li

strict subs" in use at -e line 1.

2012-03-06 Thread lina
$ perl -Mstrict -wle '{my $char = chr(Ox394) ; print $char;}' Bareword "Ox394" not allowed while "strict subs" in use at -e line 1. Execution of -e aborted due to compilation errors. I don't understand the above error message well, Thanks ahead for any explainations, Best Regards, -- To unsub

Re: read and write

2012-03-05 Thread lina
On Tue, Mar 6, 2012 at 12:23 PM, Rob Dixon wrote: > Lina the code you have shown doesn't produce that warning. If you still > need help then please post your current code. Thank you. it's weird. #!/usr/bin/env perl use strict; use warnings; use File::Spec; use File::Basename

read and write

2012-03-05 Thread lina
my $INPUTFILE = $ARGV[0]; my $tex_filename = $INPUTFILE; my $bib_filename = "/home/lina/texmf/bibtex/bib/biophymd.bib"; my $bib_abbrev_filename = "/home/lina/texmf/bibtex/bib/biophyabbrev.bib"; # divide the input file name into its path and name, # ignore its extension my ($n

Re: Learning perl

2012-03-05 Thread lina
Thanks for all of you. I will take time to do those things. Best wishes, lina -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Learning perl

2012-03-05 Thread lina
Hi, Which books are the best perl books you have ever read? How did you start learning perl? Is the books wrote before 2006 a bit older, are there much changes in the last 10 years for perl? I am keen to learning it, but so clumsy, Thanks with best regards, -- To unsubscribe, e-mail: beginne

Re: write to the file whose basename is argv[0]

2012-03-04 Thread lina
On Sun, Mar 4, 2012 at 2:34 AM, Shawn H Corey wrote: > On 12-03-03 11:37 AM, lina wrote: >> >> my $tex_filename = $ARGV[0] ; > > > # for catfile() > use File::Spec; > > # divide the input file name into its path and name, > # ignore its extension > my ( $n

Re: write to the file whose basename is argv[0]

2012-03-04 Thread lina
On Sun, Mar 4, 2012 at 2:22 AM, Shlomi Fish wrote: > Hi lina, > > On Sun, 4 Mar 2012 00:37:58 +0800 > lina wrote: > >> Hi, >> >> I want to output the result into the file shared the same basename but >> different extensions, >> >> Belo

write to the file whose basename is argv[0]

2012-03-03 Thread lina
Hi, I want to output the result into the file shared the same basename but different extensions, Below is what I have come up so far: perl try.tex #!/usr/bin/env perl use strict; use warnings; use File::Basename; my $bib_filename = "/home/lina/texmf/bibtex/bib/biophymd.bib

Re: read from command line

2012-03-03 Thread lina
Thanks for both of you. Your guys are great. Best regards, -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

read from command line

2012-03-03 Thread lina
$ perl extract.pl try.tex Bareword "filename" not allowed while "strict subs" in use at extract.pl line 8. Execution of extract.pl aborted due to compilation errors. #!/usr/bin/env perl use strict; use warnings; my $filename = $ARGV[0] ; open FILE, "<", filename or die $!; my @line = ; whil

perl -MCPAN -e shell

2012-02-28 Thread lina
Hi, I am not experienced in below choice after issue the perl -MCPAN -e shell What approach do you want? (Choose 'local::lib', 'sudo' or 'manual') /dev/sda10 6.5G 515M 5.7G 9% /usr/local /dev/sda91

Re: Use of uninitialized value within %dict in concatenation (.) or string at

2012-02-18 Thread lina
On Sun, Feb 19, 2012 at 3:34 AM, Shawn H Corey wrote: > On 12-02-18 11:40 AM, lina wrote: >>>> >>>> >>      elsif ( $xpm_file =~ /^"(\S+)[",]$/) { >> >> Are there some possibilities that something can be done for the part [",]? >>

Re: some intelligent website/modules

2012-02-18 Thread lina
On 18 Feb, 2012, at 22:55, Shawn H Corey wrote: > On 12-02-18 08:40 AM, lina wrote: >> Hi, >> >> are there some intelligent modules or website, I send it a string, >> it can intelligently analysis the structures and gave me several >> options consisted of those

Re: Use of uninitialized value within %dict in concatenation (.) or string at

2012-02-18 Thread lina
On 18 Feb, 2012, at 23:11, Shawn H Corey wrote: > On 12-02-18 09:42 AM, lina wrote: >> Hi, >> >> Sorry to open a new thread, >> >> Use of uninitialized value within %dict in concatenation (.) or string >> at ./translate.pl line 21,<$fh> line 128

Use of uninitialized value within %dict in concatenation (.) or string at

2012-02-18 Thread lina
Hi, Sorry to open a new thread, Use of uninitialized value within %dict in concatenation (.) or string at ./translate.pl line 21, <$fh> line 128. Here is the whole code (based on the guide form all of you): #!/usr/bin/perl use warnings; use strict; my $file = "dm_proAB.xpm"; open my $fh, "<"

Re: match

2012-02-18 Thread lina
On Sat, Feb 18, 2012 at 3:26 PM, Rob Dixon wrote: > On 18/02/2012 04:51, lina wrote: >> >> >> How to make a match for the following? >> >> "V  c #767676 " /* "0.808" */, >> "W  c #6F6F6F " /* "0.846" */, >&

some intelligent website/modules

2012-02-18 Thread lina
Hi, are there some intelligent modules or website, I send it a string, it can intelligently analysis the structures and gave me several options consisted of those regular expressions, Just curious, Thanks with best regards, -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For addition

match

2012-02-17 Thread lina
How to make a match for the following? "V c #767676 " /* "0.808" */, "W c #6F6F6F " /* "0.846" */, "X c #696969 " /* "0.885" */, "Y c #626262 " /* "0.923" */, "Z c #5C5C5C " /* "0.962" */, "a c #55 " /* "1" */, "b c #4E4E4E " /* "1.04" */, "c c #484848 " /* "1.08" */, I tried the /^\

Re: translate a file

2012-02-17 Thread lina
On Sat, Feb 18, 2012 at 12:53 AM, Shawn H Corey wrote: > On 12-02-17 11:43 AM, lina wrote: >> >> #!/usr/bin/perl >> >> use warnings; >> use strict; >> >> my $file = "try.xpm"; >> >> open my $fh, "<$file" or die &quo

Re: translate a file

2012-02-17 Thread lina
On Sat, Feb 18, 2012 at 12:53 AM, Shawn H Corey wrote: > On 12-02-17 11:43 AM, lina wrote: >> >> #!/usr/bin/perl >> >> use warnings; >> use strict; >> >> my $file = "try.xpm"; >> >> open my $fh, "<$file" or die &quo

Re: translate a file

2012-02-17 Thread lina
On Sat, Feb 18, 2012 at 12:33 AM, Jim Gibson wrote: > At 12:10 AM +0800 2/18/12, lina wrote: >> >> >> What's the $_ and $@ > > > They are built-in global variables. $_ is the default variable for many Perl > operations. $@ is the syntax error message from the

Re: translate a file

2012-02-17 Thread lina
On Sat, Feb 18, 2012 at 12:25 AM, Shawn H Corey wrote: > On 12-02-17 10:32 AM, lina wrote: >> >> #!/usr/bin/perl >> >> use warnings; >> use strict; >> >> open FILE, "> >> my @line =; >> >> while () { >>        print

Re: translate a file

2012-02-17 Thread lina
On Sat, Feb 18, 2012 at 12:25 AM, Shawn H Corey wrote: > On 12-02-17 10:32 AM, lina wrote: >> >> #!/usr/bin/perl >> >> use warnings; >> use strict; >> >> open FILE, "> >> my @line =; >> >> while () { >>        print

Re: translate a file

2012-02-17 Thread lina
On Fri, Feb 17, 2012 at 11:49 PM, Rob Coops wrote: > > > On Fri, Feb 17, 2012 at 4:32 PM, lina wrote: >> >> Hi, >> >> I have a file, >> >>  cat try.xpm >> a 1 >> b 2 >> c 3 >> d 4 >> >> abbbcdddb >> >

translate a file

2012-02-17 Thread lina
Hi, I have a file, cat try.xpm a 1 b 2 c 3 d 4 abbbcdddb I wish to use perl to translate the last line into the numerical value. #!/usr/bin/perl use warnings; use strict; open FILE, "; while () { print $_; } strangely it print me nothing out, Thanks for any suggestions, Bes

something about hash

2012-02-13 Thread lina
sub display_hash { my (%hash) = @_; foreach (%hash) { print "$_ => $hash{$_}\n"; } } display_hash('name' => 'Mar', 'distance' => 'forget'); distance => forget Use of uninitialized value in concatenation (.) or string at ./subroutines_examples.pl lin

  1   2   >