Re: close file if it's open

2012-08-27 Thread Praveen Kumar
Hi, On Tue, Aug 28, 2012 at 12:15 PM, lina wrote: > Thanks Jim and John. > > btw, what does the fileno mean? mean file-not-open? > perldoc -f fileno > > -- > To unsubscribe, e-mail: beginners-unsubscr...@perl.org > For additional commands, e-mail: beginners-h...@perl.org > http://learn.perl.org

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/

Re: close file if it's open

2012-08-27 Thread John W. Krahn
lina wrote: Hi, Hello, 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 $

Re: close file if it's open

2012-08-27 Thread Jim Gibson
On Aug 27, 2012, at 9:30 PM, lina wrote: > Hi, > > I don't know which is the best way to "check whether this file is open > or not," In general, you don't have to worry about it, because: 1. If a file handle goes out of scope, the file will be closed. 2. If you reuse a file handle that is ope

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: array element access

2012-08-27 Thread Shawn H Corey
On Mon, 27 Aug 2012 18:57:08 -0500 Chris Stinemetz wrote: > I am trying to incorporate sprintf to access an element in an array. Not needed. Do this instead: $cp_cell = $data[$cp_cell_index]; -- Just my 0.0002 million dollars worth, Shawn Programming is as much about organization

array element access

2012-08-27 Thread Chris Stinemetz
Hello list, Is this not possible? I am trying to incorporate sprintf to access an element in an array. Is this not possible or am i doing something wrong? $cp_cell = sprintf("$data[%s]", $cp_cell_index); The error: Global symbol "%s" requires explicit package name at form.pl line 167. Executi

Re: writing a value from a variable in PDF::API2

2012-08-27 Thread Shlomi Fish
On Mon, 27 Aug 2012 08:11:12 -0400 Shawn H Corey wrote: > On Mon, 27 Aug 2012 17:18:10 +0700 > Eko Budiharto wrote: > > > my $endDate2 = $time{'dd-mm-', time + 86400 * 14}; > > my $startDate2 = $time{'dd-mm-', time - 86400 * 0}; > > Where is the hash %time assigned its values? > > F

Re: writing a value from a variable in PDF::API2

2012-08-27 Thread Shawn H Corey
On Mon, 27 Aug 2012 17:18:10 +0700 Eko Budiharto wrote: > my $endDate2 = $time{'dd-mm-', time + 86400 * 14}; > my $startDate2 = $time{'dd-mm-', time - 86400 * 0}; Where is the hash %time assigned its values? -- Just my 0.0002 million dollars worth, Shawn Programming is as much

writing a value from a variable in PDF::API2

2012-08-27 Thread Eko Budiharto
dear members, I wrote a perl script to write a pdf file. I am stuck in writing a value from a variable. Please help. thanks in advance. Here is my script: #!/usr/local/bin/perl use CGI qw(:standard); use strict; use PDF::API2; my $endDate2 = $time{'dd-mm-', time + 86400 * 14}; my $startDat