On Fri, 15 Apr 2011 08:53:12 -0700, sono-io wrote:
> On Apr 15, 2011, at 8:37 AM, Alan Haggai Alavi wrote:
>
>>> open ('FILEOUT', '>>', 'cmdout') ||die "cant open cmdout: $! \n";
>>>
>>> Is that O.K.?
>>
>> You are still using a bareword filehandle.
>
> Putting single quotes around t
On 11-04-15 11:22 AM, sono...@fannullone.us wrote:
open ('FILEOUT', '>>', 'cmdout') ||die "cant open cmdout: $! \n";
Is that O.K.?
The problem with not using lexical-scoped file handles is that if a
module opens a file using the same name, it closes yours. It's best if
you limit the
On Apr 15, 2011, at 8:37 AM, Alan Haggai Alavi wrote:
>> open ('FILEOUT', '>>', 'cmdout') ||die "cant open cmdout: $! \n";
>>
>> Is that O.K.?
>
> You are still using a bareword filehandle.
Putting single quotes around the filehandle allows it to pass Perl
Critic, so I was just cu
Hello Marc,
What about writing it like this:
open ('FILEOUT', '>>', 'cmdout') ||die "cant open cmdout: $! \n";
Is that O.K.?
You are still using a bareword filehandle.
Regards,
Alan Haggai Alavi.
--
The difference makes the difference
--
To unsubscribe, e-mail: beginners-un
On Apr 15, 2011, at 2:11 AM, Shlomi Fish wrote:
> 1. Don't use bareword file-handles.
>
> 2. Use the three-args open:
>
> open (my $file_our, '>>', 'cmdout') or die "Cannot open cmdout: $!";
What about writing it like this:
open ('FILEOUT', '>>', 'cmdout') ||die "cant open cmdout: $! \
Hi jet speed,
On Friday 15 Apr 2011 00:23:17 jet speed wrote:
> Hi,
>
> I need help in formatting ouput from system command, i could'nt figure out
> a way to format output from system command. appreciate your help with
> this, the details are below.
>
> hlis3 is file with list of clients
>
> h
"Chas. Owens" writes:
> I believe you want either [Text::Wrap][1] (which has been a part of
> the core since Perl 5.2):
Nice... yes I wish I'd known about this tool some time ago... thanks
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners
On Sun, Jul 26, 2009 at 17:37, Harry Putnam wrote:
> I'm a little lost even what to look for to do this.
>
> With a variable like this:
>
> $var = 'American Express offers individuals online access to its world-class
> Card, Financial, and Travel services, including financial advice, retirement
>
Moon, John wrote:
>
> Does anyone see the problem with the following format?
>
> Thank you in advance for any help...
>
> John W Moon
>
>127
>128 format ADJRPT =
>129 @<<... @> @| @<<< @<...
> @<<... @>>>
>13
William wrote:
>
> John W. Krahn wrote:
>>
>> $ perl -le'
>> for my $num ( 123, 123456 ) {
>> print 1 + $num;
>> }
>> '
>> 10123
>> 100123456
>
>
> Thank you, but I think this solution is more descent
>
> Bob McConnell wrote:
>>
>> Just insert the literal digit in the format
> $ perl -le'
> for my $num ( 123, 123456 ) {
> print 1 + $num;
> }
> '
> 10123
> 100123456
>
>
>
> John
> --
Thank you, but I think this solution is more descent
> Just insert the literal digit in the format and trim the size
> accordingly.
>
> sprintf("1%08d", $numbe
William wrote:
Hello,
Hello,
I want to format a number to become a 9 digits representation, every
time it must have an integer 1 at the front.
E.g
123 become 10123
123456 become 100123456
$ perl -le'
for my $num ( 123, 123456 ) {
print 1 + $num;
}
'
10123
1001234
Thank you very much, I don't if the solution is so simple. Hehe
- Original Message
> From: Bob McConnell <[EMAIL PROTECTED]>
> To: beginner perl mailling list
> Sent: Tuesday, June 10, 2008 23:40:29
> Subject: RE: format number with leading non-zero
>
>
Just insert the literal digit in the format and trim the size
accordingly.
sprintf("1%08d", $number);
Bob McConnell
-Original Message-
From: William [mailto:[EMAIL PROTECTED]
Sent: Tuesday, June 10, 2008 11:05 AM
To: beginner perl mailling list
Subject: format number with leading non-ze
On 11/24/07, Avinash S <[EMAIL PROTECTED]> wrote:
> I want to extract only the block which has the key word [WARNING]
It sounds as if you wish to process many lines at once, rather than
one line at a time. Is that right?
> while ()
> chomp;chomp;
Why two chomps? The first one removed th
Hi,
Yes, I have a trouble in parsing through the raw log. I am using the
"-->" symbol to parse through the log.
From
--
--> Validating DNS Server Entries <--
--
Servers should conform to global ANYCast Standard
On 11/23/07, Avinash S <[EMAIL PROTECTED]> wrote:
> I need to format the below logs.
...
> after this I want to send a mail.
Sounds like you know what you want to do. Are you having trouble
implemening any part of it in Perl?
Cheers!
--Tom Phoenix
Stonehenge Perl Training
--
To unsubscribe, e
On Friday 09 November 2007 10:30, [EMAIL PROTECTED] wrote:
> Ok, so I'm not *really* a beginner; however, wondering if this is
> possible
You have read the perlform man page?
perldoc perlform
> I have a subroutine that basically goes through an array and searches
> for processes... It has t
On 9/18/07, VUNETdotUS <[EMAIL PROTECTED]> wrote:
snip
> I liked Text::Table idea but it is not supported on my machine.
> Now I try printf but I came across a few problems. The sample above
> produces a good result. However, when I implement according to my
> needs, I cannot printf my multidimensi
On Sep 17, 7:57 pm, [EMAIL PROTECTED] (Chas Owens) wrote:
> On 9/17/07, VUNETdotUS <[EMAIL PROTECTED]> wrote:> I print some output in
> PERL. It is data in 3 columns. I use \t to add
> > a tab space to make a column.
> > However, \t may not produce the desired result. If the value is short
> > in
On Sep 18, 12:57 am, [EMAIL PROTECTED] (Chas Owens) wrote:
> On 9/17/07, VUNETdotUS <[EMAIL PROTECTED]> wrote:> I print some output in
> PERL. It is data in 3 columns. I use \t to add
> > a tab space to make a column.
> > However, \t may not produce the desired result. If the value is short
> > in
On 9/17/07, VUNETdotUS <[EMAIL PROTECTED]> wrote:
> I print some output in PERL. It is data in 3 columns. I use \t to add
> a tab space to make a column.
> However, \t may not produce the desired result. If the value is short
> in length, next column is not aligned correctly in the row. Something
>
> -Original Message-
> From: VUNETdotUS [mailto:[EMAIL PROTECTED]
> Sent: Monday, September 17, 2007 12:36
> To: beginners@perl.org
> Subject: Format Output
>
> I print some output in PERL. It is data in 3 columns. I use \t to add
> a tab space to make a column.
> However, \t may not prod
On 8/16/07, Mathew Snyder <[EMAIL PROTECTED]> wrote:
snip
> Would you recommend straight Perl to handle the formatting or is there another
> method that can handle this?
snip
There are many template modules in CPAN that might make your life
easier, but in general I stick to printf.
--
To unsubsc
Tom Phoenix wrote:
> On 8/15/07, Mathew Snyder <[EMAIL PROTECTED]> wrote:
>
>> How would I go about sub-listing something. For instance, if I have a work
>> order that has been worked on during different days, I want to list the work
>> order once and each day below it. It would look like this:
On 8/15/07, Mathew Snyder <[EMAIL PROTECTED]> wrote:
> How would I go about sub-listing something. For instance, if I have a work
> order that has been worked on during different days, I want to list the work
> order once and each day below it. It would look like this:
>
> Ticket ID
Offer Kaye wrote:
> Hi,
> Can anyone tell me if it is possible to define 2 different formats for
> the same filehandle?
>
Yes. Use the select command to select the filehandle of the file. Then
use the special variables $~ and $^ to change the format. The format
name can be anything you want but i
Offer Kaye wrote:
On 7/5/06, Jeff Peng wrote:
Hello,
I think there are not relation between your implement and the filehandle.
As far as I can tell, a format must have the same name as the
filehandle to which you want to print it, and once you define a format
you cannot change it. So these 2
On 7/5/06, John W. Krahn wrote:
#!/usr/bin/perl
use warnings;
use strict;
sub _print_format1 {
# output table 1, with 3 columns
$^A = '';
formline <<'FORMAT', @_;
@<< @>>> @<
FORMAT
$^A;
}
Wow. That's... impressive. Ver
Offer Kaye wrote:
> Hi,
Hello,
> Can anyone tell me if it is possible to define 2 different formats for
> the same filehandle?
>
> The reason I am asking is that I want to print 2 different tables to
> the same text file and I don't want to use printf statements. For me
> at least, code that use
Offer Kaye wrote:
Hi,
Can anyone tell me if it is possible to define 2 different formats for
the same filehandle?
The reason I am asking is that I want to print 2 different tables to
the same text file and I don't want to use printf statements. For me
at least, code that uses printf to print som
Here a script that illustrates my current workaround:
#! /usr/bin/env perl
use strict;
use warnings;
my $outfile = "file_with_tables.txt";
open(OUT,">$outfile") or die "Couldn't open $outfile for writing: $!\n";
print OUT "Table 1:\n";
_print_format1(1,15,"foo");
_print_format1(2,8,"bar");
clos
On 7/5/06, Jeff Peng wrote:
Hello,
I think there are not relation between your implement and the filehandle.
As far as I can tell, a format must have the same name as the
filehandle to which you want to print it, and once you define a format
you cannot change it. So these 2 facts mean you can'
The reason I am asking is that I want to print 2 different tables to
the same text file and I don't want to use printf statements. For me
at least, code that uses printf to print something as complex as a
text table is hard to both write and read, hard to understand and hard
to debug. It's also
On Mon, 2006-15-05 at 17:46 -0700, chen li wrote:
> Hi all,
>
> I get data from Data::Dumper in an array format.
> I just wonder if there is a means to format the
> content in alphabetic order, something like "sort keys
> or sort values".
Data::Dumper can output hashes sorted by keys:
$Data::D
Hi all,
I use the following script to find out the methods
available from a class of Bio::Seq.
#!c:/Perl/bin/Perl.exe
use warnings;
use strict;
use Bio::Seq;
use Data::Dumper;
use Class::Inspector;
my $methods=Class::Inspector->methods('Bio::Seq',
'full','public');
print Data::Dumper->Dump([$m
Jeff Pang schreef:
> print Dumper @sort;
I always go for the whole thing:
print Data:Dumper->Dump( [EMAIL PROTECTED], [qw(*sort)] );
perl -MData::Dumper -e '
@s = sort( 1, 7, 3, 2, 5 ) ;
print Data::Dumper->Dump( [ [EMAIL PROTECTED] ], [ qw(*s) ] )
'
@s = (
1,
2,
3,
>Jeff Pang wrote:
>
>: my @original=(...);
>: my @sort=sort {$a cmp $b} @original;
>: print Dumper @sort;
>
>You might like the results better using an array reference.
>
>print Dumper [EMAIL PROTECTED];
>
Sorry,my mistake.It's right really to use an array reference here.
--
Jeff Pang
NetEas
Jeff Pang wrote:
: my @original=(...);
: my @sort=sort {$a cmp $b} @original;
: print Dumper @sort;
You might like the results better using an array reference.
print Dumper [EMAIL PROTECTED];
Or you could avoid the extra array with the anonymous array
constructor (or is it an operator?
>
>I get data from Data::Dumper in an array format.
>I just wonder if there is a means to format the
>content in alphabetic order, something like "sort keys
>or sort values".
I would give you a simple way,you can sort the array and put the results into
another array,then print this array to Dump
Brano Gerzo:
> I like format function, but I miss output to scalars.
I think you mean 'to text strings' and are looking for sprintf.
perldoc -f sprintf
--
Affijn, Ruud
"Gewoon is een tijger."
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Thanks. Was right there in the manual... -Sam
--- "Moon, John" <[EMAIL PROTECTED]> wrote:
> Subject: 'format' puzzle
>
> How can I create a perl 'format' string that begins with a comment (#)?
>
> Eg.
>
> format STDOUT_TOP =
> # Field1 Field2
> @<< @||| @|||
> .
>
>
> If I try '\#'
Subject: 'format' puzzle
How can I create a perl 'format' string that begins with a comment (#)?
Eg.
format STDOUT_TOP =
# Field1 Field2
@<< @||| @|||
.
If I try '\#' then I see the backslash. I just want the pound char.
TIA,
-Sam
I'm not sure where you want the "#" ... but
DEV,S
Sorry, list members -- I'm going to answer this guy in his native
tongue. Feel free to setlocale(LC_CTYPE, "es_MX.ISO8859-1") :)
[EMAIL PROTECTED] (Rafael Morales) writes:
> Hi list.
>
> I tapeworm a disordered file which I repair it and produces this exit to me
> in my shell:
Una traducci
Rafael Morales wrote:
Hi list.
Hello,
I tapeworm a disordered file which I repair it and produces this exit to me in my shell:
I am not sure what you mean by "tapeworm"?
UNIDAD |
TOTAL
Brian Volk wrote:
Thank you very much, where can I read more about:
local $/ = ''; # enables "paragraph mode"
Perl's predefined variables are described in
perldoc perlvar
The expression "paragraph mode" is not used there, but the technique is
described.
--
Gunnar Hjalmarsson
Email: http://ww
CTED]
> Sent: Thursday, October 14, 2004 4:45 PM
> To: [EMAIL PROTECTED]
> Subject: Re: re-format database file
>
>
> Brian Volk wrote:
> > I have a database file, some_sch.txt that is arranged like this:
> >
> > username1
> > First Last
&
Brian Volk wrote:
I have a database file, some_sch.txt that is arranged like this:
username1
First Last
Some Community Sch
1000 S Adams St
Town, Indiana 12345 U.S.A.
username2
First Last
Some Community Sch
1000 S Adams St
Town, Indiana 12345 U.S.A.
username3
First Last
Some Community
> I have a database file, some_sch.txt that is arranged like this:
>
> username1
> First Last
> Some Community Sch
> 1000 S Adams St
> Town, Indiana 12345 U.S.A.
>
> username2
> First Last
> Some Community Sch
> 1000 S Adams St
> Town, Indiana 12345 U.S.A.
>
> username3
> First Last
> Some Communit
Hi All,
I have a database file, some_sch.txt that is arranged like this:
username1
First Last
Some Community Sch
1000 S Adams St
Town, Indiana 12345 U.S.A.
username2
First Last
Some Community Sch
1000 S Adams St
Town, Indiana 12345 U.S.A.
username3
First Last
Some Community Sch
10
Well, I've made some changes... not sure if it was for the better but at
least I'm learning from the research! :-)
I don't think the split is really doing anything (but I'd like it to.. :-) )
and my format STDOUT is producing the error "Use of uninitialized value in
formline... ?? not sure what
rmck wrote:
> I cant get localtime to print in "mm-dd- hh:mm:ss" , I keep
> getting it like so "Sun Dec 28 03:35:19 2003"
POSIX::strftime gives you complete control over the format.
use POSIX 'strftime';
print strftime('%m-%d-%Y %H:%M:%S', localtime), "\n";
perldoc POSIX
--
To unsubscr
> Hi
>
> I have the following script that sucks in a file and converts
> unix timestamp to human readable..
>
> The Goal is to do a search and replace of unix time to the
> format i need. But I'm just trying to get it to print in the
> format i need first...
>
> I cant get localtime to prin
> On Fri, Jun 20, 2003 at 02:44:43PM BRT , John W. Krahn wrote:
|
|This will work:
|
|# have to declare @fields here so format can see it.
|my @fields;
|
|format STDOUT =
|@ @#.## @#.## @#.##
|@fields
|.
|
|while ( ) {
|# get the fields
Ataualpa Albert Carmo Braga wrote:
>
> Hi,
Hello,
> this is my first message to list, than sorry for so basic question e
> for so bad english. I will try improve both.
>
> I did a small script with perl and I'd like to format the output:
>
> C -3.7975162.078833-0.
Ataualpa Albert Carmo Braga wrote at Fri, 20 Jun 2003 02:28:11 -0300:
> I did a small script with perl and I'd like to format the output:
>
> C -3.7975162.078833-0.795507
> C 4.0463240.905644-0.106181
> C 4.0372860.8874121.283492
>
Hi,
disregards
I see what you mean now.
Anthony
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Hi,
What has changed? from both sets?
to me they are identical
Anthony
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Prasad Karpur wrote:
> All,
>
> When I try to use $pathname to get the dir name in the format section, I don't see
> any value. Also where do I add the follow_skip section in the File::Find program to
> skip duplicate file names.
>
> #!/usr/bin/perl
>
> use File::Find;
>
> format OUTPUT_TOP =
>
that doesn't really work. if you have a large list and don't want to spell
out each individual elements, try generating the format list yourself and
then just eval it in run time like:
#!/usr/bin/perl -w
use strict;
my @a = (1..5);
my $eval = <<'START';
format FM =
=
a
> -Original Message-
> From: Dan Fish [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, May 07, 2002 8:33 AM
> To: [EMAIL PROTECTED]
> Subject: Format of %e output
>
>
> I've got this *really ancient* program (for which I naturally
> don't have the
> source :-) that parses reports and expe
on Tue, 07 May 2002 12:33:15 GMT, [EMAIL PROTECTED] (Dan Fish) wrote:
> Is there a way to force perl to output using the %e format with
> only 2 exponent digits??
>
I didn't find any. In the meantime, you could use a substitution:
my $number = sprintf("%E", -0.0001);
$number =~ s/(E[+-]
Guru^Garzah wrote:
>
> Say I have a list like this
> DOGFEMALE DALMATION62 POUNDS299.00320.00
> DOGFEMALE DALMATION12 POUNDS280.00320.00
> DOGGERMAN SHEPARD48 POUNDS290.00330.00
> CAT FEMALE PERSIAN 8 POUNDS219.00300.00
> CATMALE C
At 05:19 PM 12/17/01 +1030, Daniel Falkenberg wrote:
>print<
>
>
> Out
> Of Office Message
>
> cols="41">@vac
>
>
Easiest thing to maintain would be something like
my $vac = join '', @vac;
Then put $vac inside the textarea inst
-Original Message-
From: Kristina Nairn [mailto:[EMAIL PROTECTED]]
Sent: Monday, 17 December 2001 3:14 PM
To: Daniel Falkenberg; Peter Scott
Cc: [EMAIL PROTECTED]
Subject: Re: Format of array in HTML text box gone weird...
Try the following code:
undef $";
print "@lines";
$"
e got a 'print "@lines";' thing going on.
Please include your perl code in your post.
Cheers,
Kristina
- Original Message -
From: "Daniel Falkenberg" <[EMAIL PROTECTED]>
To: "Peter Scott" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Peter,
That is exactly what it does but is there any way to get rid of that?
Regards,
Dan
-Original Message-
From: Peter Scott [mailto:[EMAIL PROTECTED]]
Sent: Monday, 17 December 2001 2:28 PM
To: Daniel Falkenberg; [EMAIL PROTECTED]
Subject: Re: Format of array in HTML text box gone
At 02:23 PM 12/17/01 +1030, Daniel Falkenberg wrote:
>Just working on some HTML stuff at the moment and I have a come across a
>little problem that I don't really understand
>
>Basically I place the following ararry (really only text) into a
>scrolling text box but when the text array is seen
John_Kennedy [mailto:[EMAIL PROTECTED]] wrote:
> I have the following script (simplified)
>
> #!/path/to/perl -w
> open LIST,"/path/to/data" or die "/path/to/data: $!";
> open(SENDMAIL, "|/usr/lib/sendmail -oi -t") or die "Unable to
> fork: $!";
> format SENDMAIL=
> From: Me <[EMAIL PROTECTED]>
>
On Thu, 6 Sep 2001, John_Kennedy wrote:
> I have the following script (simplified)
>
> #!/path/to/perl -w
> open LIST,"/path/to/data" or die "/path/to/data: $!";
> open(SENDMAIL, "|/usr/lib/sendmail -oi -t") or die "Unable to fork: $!";
> format SENDMAIL=
> From: Me <[EMAIL PROTECTED]>
> To: You
>And remember, the key to having someone actually read your code is to make
>it readable; make good use of whitespace and indentation, this isn't an
>obfuscated Perl contest.
I'd also include, with a healthy shout, to comment your own code first. It
helps people a lot if we can see what you w
On Mon, Aug 13, 2001 at 02:50:13PM -0400, Yacketta, Ronald wrote:
> What format should one post code reviews in? attachments? script included
> in email? url?
It depends on the size of the code. I'd say if it's any more than, say, 100
lines put it on a web site somewhere. Otherwise, include it
The reason the cat is that there are mulitple grades per line. So if you
do assignment only, then you will have only the last grade.
To get 2.5, etc then you could use %4.1f to get to one decimal point.
Wags ;) ps Unknown about formats. Sorry.
-Original Message-
From: David Gilden [
> Hi
> Is there a module out there that will help me
> format data coming from an Access Database.
> Win32::OLE looks a bit daunting though I'm
> sure it will allow the typographic variety I'm
> looking for.
That's too vague.
Basically, please explain your constraints.
If there are none, then i
74 matches
Mail list logo