The data that I pasted is the output of Data dumper itself.
In the below code
variable contains that Data dumper output and I am trying to read that data through foreach to display value and name info but couldn't.
Please let me know if you question is not so clear.
Just want to learn how these are read into array but I don't seem to get it right what do I go wrong?
Below is the sample
Thanks
input
1 2 3 4
5 6 7 8
9 1 2 3
4 5 6 7
#!/usr/bin/perl
open (InFILE,"input");
while (<InFILE>) {
@ar = split ; (5 Replies)
I'm trying to make changes in a file using the following bash script:
#!/bin/bash
MYHOME=`echo $HOME`
README=$MYHOME"/environment"
IAM=`whoami`
CHANGEPATHLIST="TALOG TACONFIG TAINFO TAWORK TMPSPACE"
for var in $CHANGEPATHLIST
do
perl -pi -e 's/sacuser1/$IAM/ if m/$var/' $README... (3 Replies)
I am trying to read in a 2 column data file into Perl Hash array index. Here is my code.
#!/usr/bin/perl -w
use strict;
use warnings;
my $file = "file_a";
my @line = ();
my $index = 0;
my %ind_file = ();
open(FILE, $file) or die($!);
while(<FILE>) {
chomp($_);
if ($_ eq '')
{
... (1 Reply)
I was trying to store the number of lines in a file and store it in a file.after that i want to store the information in a file to a variable which is further used in the if loop to check certain condition.
#!/bin/bash
cat <file> | wc -l > count.txt
x="$count.txt";
i=10;
if ; then
cat... (10 Replies)
Hi, I am writting some perl scripts for daily backup process. In which I want to pass some data/referance from another txt file. Text file contains only one column and multiple rows. I want to pass this data to variables of another perl script.
e.g.
Refdoc.txt file contains data as:
perl1... (3 Replies)
I am new to Perl and just started using the data::dumper.
i have been unable to figure out how to take the output that comes from the data::dumper and redirect it to a file.
I tried this....
sub postEvent {
my $this = shift;
# print "Passed parameters, " . Dumper(\@_) .... (3 Replies)
HI,
i have variable in perl like below
$tmp="/home/sai/automation/work/TFP_GN.txt"
it can conatain any path its filled from config file.
now i want extarct the path upto this /home/sai/automation/work/ and put it in another variable
say... (4 Replies)
Hi,
i need a perl script which reads the file, content is given below. and output in new file.
TARGET DRIVE IO1 IO2 IO3 IO4 IO5
------------ --------- --------- --------- --------- ---------
0a.1.8 266 236 ... (3 Replies)
Hi all,
I have written a perl code and stored the data into Data structure using Data::Dumper module.
But not sure how to retreive the data from the Data::Dumper.
Eg.
Based on the key value( Here CRYPTO-6-IKMP_MODE_FAILURE I should be able to access the internal hash elements(keys) ... (1 Reply)
I have a file abc.ini and declared many variables in that file, one of the variable(DBname) value I am trying to read in my perl script but getting error.
File abc.ini content
# database name
DBname =UATBOX
my $ex_stat;
my $cmd_output;
$ex_stat = "\Qawk '/^DBname/{print... (2 Replies)
Discussion started by: Devesh5683
2 Replies
LEARN ABOUT OSX
ppi::dumper
PPI::Dumper(3) User Contributed Perl Documentation PPI::Dumper(3)NAME
PPI::Dumper - Dumping of PDOM trees
SYNOPSIS
# Load a document
my $Module = PPI::Document->new( 'MyModule.pm' );
# Create the dumper
my $Dumper = PPI::Dumper->new( $Module );
# Dump the document
$Dumper->print;
DESCRIPTION
The PDOM trees in PPI are quite complex, and getting a dump of their structure for development and debugging purposes is important.
This module provides that functionality.
The process is relatively simple. Create a dumper object with a particular set of options, and then call one of the dump methods to
generate the dump content itself.
METHODS
new $Element, param => value, ...
The "new" constructor creates a dumper, and takes as argument a single PPI::Element object of any type to serve as the root of the tree to
be dumped, and a number of key->value parameters to control the output format of the Dumper. Details of the parameters are listed below.
Returns a new "PPI::Dumper" object, or "undef" if the constructor is not passed a correct PPI::Element root object.
memaddr
Should the dumper print the memory addresses of each PDOM element. True/false value, off by default.
indent
Should the structures being dumped be indented. This value is numeric, with the number representing the number of spaces to use when
indenting the dumper output. Set to '2' by default.
class
Should the dumper print the full class for each element. True/false value, on by default.
content
Should the dumper show the content of each element. True/false value, on by default.
whitespace
Should the dumper show whitespace tokens. By not showing the copious numbers of whitespace tokens the structure of the code can often
be made much clearer. True/false value, on by default.
comments
Should the dumper show comment tokens. In situations where you have a lot of comments, the code can often be made clearer by ignoring
comment tokens. True/value value, on by default.
locations
Should the dumper show the location of each token. The values shown are [ line, rowchar, column ]. See "location" in PPI::Element for a
description of what these values really are. True/false value, off by default.
print
The "print" method generates the dump and prints it to STDOUT.
Returns as for the internal print function.
string
The "string" method generates the dump and provides it as a single string.
Returns a string or undef if there is an error while generating the dump.
list
The "list" method generates the dump and provides it as a raw list, without trailing newlines.
Returns a list or the null list if there is an error while generation the dump.
SUPPORT
See the support section in the main module.
AUTHOR
Adam Kennedy <adamk@cpan.org>
COPYRIGHT
Copyright 2001 - 2011 Adam Kennedy.
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.16.2 2011-02-25 PPI::Dumper(3)