Hello,
I am trying to output the values in an array to a file. The output needs to be formated such that each array value is left jusified in a field 8 character spaces long. Also, no more than 6 fields on a line. For example:
@array= 1..14;
Needs to be output to the file like so:
1 ... (4 Replies)
I am not sure if this is doable. I am trying to open and print the content of the file by replacing all instances fo perl to PERL . This is my code but it is
giving me the number count instead of the actual lines with changes.
open (PERLHISTORY, 'sample.txt') or die "The file sample.txt could... (3 Replies)
Hi everyone
I have one question about using array in perl. let say I have several log file in one folder.. example
test1.log
test2.log
test3.log
and the list goes on..
how to make an array for this file? It suppose to detect log file in the current directory and all the log file will... (3 Replies)
I'm using Mail::Internet module, which will basically filter through email content and extract the body of the message
my perl script to extract the body of the email
#!/usr/bin/perl -w
use Mail::Internet;
@lines = <STDIN>;
$mi_obj = new Mail::Internet();
... (2 Replies)
Hi, as the title, I have an array @f_lines with gene information in it. How can I put the content of @f_lines into a file so that I can read it?
I tried this:
open(OUTPUT, "file"); # put gene information in this file;
@f_lines = ("gene1", "gene2", "gene3"...); # gene information;
print... (3 Replies)
Hi All,
I have a file content like this.
#<clear_category_list>
#<include file="SUITE:Provision-FLEXPONDER_FAC.inc">
#<include file="CAT:SYSTEM:SAS_U23.inc">
#<include file="CAT:PRIORITY:10.inc">
#<include file="CAT:FAC_TYPE:OC48.inc">
#<include file="CAT:FAC_TYPE:OC192.inc">... (2 Replies)
Hi All,
I wanted to write a perl script to read the content in a file,the file content is either 0 (zero) OR 1. The idea is like this.
If (content =1), then it will proceed to perform some step. and then update the file content to 0(zero)
else
if (content =0), it will update the content to... (11 Replies)
Hi,
I created a skript in ksh which generate a file with semicolon as separator, this is an example of the file a created:
example content file:
hello;AAAA;2014-08-17
hello;BBBB;2014-08-17
hello;CCCC;2014-08-17
I would need to compare the content in of the second column of this file... (3 Replies)
Discussion started by: jmartin
3 Replies
LEARN ABOUT DEBIAN
tap::parser::yamlish::writer
TAP::Parser::YAMLish::Writer(3pm) User Contributed Perl Documentation TAP::Parser::YAMLish::Writer(3pm)NAME
TAP::Parser::YAMLish::Writer - Write YAMLish data
VERSION
Version 3.25
SYNOPSIS
use TAP::Parser::YAMLish::Writer;
my $data = {
one => 1,
two => 2,
three => [ 1, 2, 3 ],
};
my $yw = TAP::Parser::YAMLish::Writer->new;
# Write to an array...
$yw->write( $data, @some_array );
# ...an open file handle...
$yw->write( $data, $some_file_handle );
# ...a string ...
$yw->write( $data, $some_string );
# ...or a closure
$yw->write( $data, sub {
my $line = shift;
print "$line
";
} );
DESCRIPTION
Encodes a scalar, hash reference or array reference as YAMLish.
METHODS
Class Methods
"new"
my $writer = TAP::Parser::YAMLish::Writer->new;
The constructor "new" creates and returns an empty "TAP::Parser::YAMLish::Writer" object.
Instance Methods
"write"
$writer->write($obj, $output );
Encode a scalar, hash reference or array reference as YAML.
my $writer = sub {
my $line = shift;
print SOMEFILE "$line
";
};
my $data = {
one => 1,
two => 2,
three => [ 1, 2, 3 ],
};
my $yw = TAP::Parser::YAMLish::Writer->new;
$yw->write( $data, $writer );
The $output argument may be:
o a reference to a scalar to append YAML to
o the handle of an open file
o a reference to an array into which YAML will be pushed
o a code reference
If you supply a code reference the subroutine will be called once for each line of output with the line as its only argument. Passed lines
will have no trailing newline.
AUTHOR
Andy Armstrong, <andy@hexten.net>
SEE ALSO
YAML::Tiny, YAML, YAML::Syck, Config::Tiny, CSS::Tiny, <http://use.perl.org/~Alias/journal/29427>
COPYRIGHT
Copyright 2007-2011 Andy Armstrong.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
The full text of the license can be found in the LICENSE file included with this module.
perl v5.14.2 2012-06-05 TAP::Parser::YAMLish::Writer(3pm)