Sponsored Content
Top Forums Shell Programming and Scripting Perl : reading data from dumper variable Post 302984618 by rbatte1 on Friday 28th of October 2016 07:03:49 AM
Old 10-28-2016
Is this the module Data::Dumper?

If so, you might do better with:-
Code:
#!/usr/bin/perl
use Data::Dumper ;
:
:       # Whatever else you need to do
:
:
print Dumper($variable) ;

is this what you are after, or have I missed the point?




Robin

Last edited by Don Cragun; 10-28-2016 at 04:48 PM.. Reason: Get rid of accidental smiley.
This User Gave Thanks to rbatte1 For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Reading data into muti-dimentional array - in perl

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)
Discussion started by: zap
5 Replies

2. Shell Programming and Scripting

perl not reading my variable

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)
Discussion started by: yoonixq4u
3 Replies

3. Shell Programming and Scripting

PERL: reading 2 column data into Hash file

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)
Discussion started by: subhap
1 Replies

4. Shell Programming and Scripting

Reading data from file and assigning to variable

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)
Discussion started by: sudhakaryadav
10 Replies

5. Shell Programming and Scripting

Perl: Reading data from other file

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)
Discussion started by: n.dba
3 Replies

6. Shell Programming and Scripting

log data::dumper output to file

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)
Discussion started by: LRoberts
3 Replies

7. Shell Programming and Scripting

Data extraction in perl variable

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)
Discussion started by: raghavendra.nsn
4 Replies

8. Shell Programming and Scripting

Perl Script for reading table format data from file.

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)
Discussion started by: asak
3 Replies

9. Shell Programming and Scripting

Perl :: reading values from Data Dumper reference in Perl

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)
Discussion started by: scriptscript
1 Replies

10. Shell Programming and Scripting

Error while reading variable from a file in perl script

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
PPIx::Regexp::Dumper(3pm)				User Contributed Perl Documentation				 PPIx::Regexp::Dumper(3pm)

NAME
PPIx::Regexp::Dumper - Dump the results of parsing regular expressions SYNOPSIS
use PPIx::Regexp::Dumper; PPIx::Regexp::Dumper->new( 'qr{foo}smx' ) ->print(); INHERITANCE
"PPIx::Regexp::Dumper" is a PPIx::Regexp::Support. "PPIx::Regexp::Dumper" has no descendants. DESCRIPTION
This class generates a formatted dump of a PPIx::Regexp::Element object (or any subclass thereof), a PPIx::Regexp::Tokenizer object, or a string that can be made into one of these. METHODS
This class provides the following public methods. Methods not documented here are private, and unsupported in the sense that the author reserves the right to change or remove them without notice. new my $dumper = PPIx::Regexp::Dumper->new( '/foo/', ordinal => 1, ); This static method instantiates the dumper. It takes the string, PPI::Element, PPIx::Regexp::Element, or PPIx::Regexp::Tokenizer to be dumped as the first argument. Optional further arguments may be passed as name/value pairs. The following options are recognized: default_modifiers array_reference This argument is a reference to a list of default modifiers to be applied to the statement being parsed. See PPIx::Regexp new() for the details. encoding name This argument is the name of the encoding of the regular expression. If specified, it is passed through to PPIx::Regexp->new(). It also causes an "Encode::encode" to be done on any parse content dumped. indent number This argument is the number of additional spaces to indent each level of the parse hierarchy. This is ignored if either the "test" or "tokens" argument is true. The default is 2. margin number This is the number of spaces to indent the top level of the parse hierarchy. This is ignored if the "test" argument is true. The default is zero. ordinal boolean If true, this option causes the "ordinal" values of PPIx::Regexp::Token::Literal objects to be dumped. perl_version boolean If true, this option causes the "perl_version_introduced" and "perl_version_removed" values associated with each object dumped to be displayed. significant boolean If true, this option causes only significant elements to be dumped. The default is false. test boolean If true, this option causes the output to be formatted as a regression test rather than as a straight dump. The output produced by asserting this option is explicitly undocumented, in the sense that the author reserves the right to change the generated output without notice of any kind. The default is false. tokens boolean If true, this option causes a dump of tokenizer output rather than of a full parse of the regular expression. This is forced true if the dump is of a PPIx::Regexp::Tokenizer. The default is false. trace number If greater than zero, this option causes a trace of the parse. This option is unsupported in the sense that the author reserves the right to change it without notice. The default is zero. verbose number If greater than zero, this option causes additional information to be given about the elements found. This option is unsupported in the sense that the author reserves the right to change it without notice. The default is zero. If the thing to be dumped was a string, unrecognized arguments are passed to "PPIx::Regexp::Tokenizer->new()". Otherwise they are ignored. list print map { "$_ " } $dumper->list(); This method produces an array containing the dump output, one line per element. The output has no left margin applied, and no newlines. print $dumper->print(); This method simply prints the result of "string" to standard out. string print $dumper->string(); This method adds left margin and newlines to the output of "list", concatenates the result into a single string, and returns that string. SUPPORT
Support is by the author. Please file bug reports at <http://rt.cpan.org>, or in electronic mail to the author. AUTHOR
Thomas R. Wyant, III wyant at cpan dot org COPYRIGHT AND LICENSE
Copyright (C) 2009-2012 by Thomas R. Wyant, III This program is free software; you can redistribute it and/or modify it under the same terms as Perl 5.10.0. For more details, see the full text of the licenses in the directory LICENSES. This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose. perl v5.14.2 2012-06-06 PPIx::Regexp::Dumper(3pm)
All times are GMT -4. The time now is 08:48 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy