Hi:
How do I pass a hash table down to a subroutine along with some other variables?
For example, I have say a subroutine play_with_hash:
sub play_with_hash
{
my( $var1, $var2, %my_hash ) = @_;
#do stuff with %my_hash
...........
}
Then I want to call the subroutine... (1 Reply)
All,
I have a sh script of the following tune:
function a () { #functionality.. }
function b () { #functionnlity.. }
function check () { # this function checks for env and if all fine call build }
function usage () { #sh usage details }
function build () { #calls either a or b or... (5 Replies)
Hi,
I have a function that hold 3 arrayies.
I need to pass them to another function as an input, for further use
Could you please explain how to do that.
Thanks (5 Replies)
I have a script (say script1.sh ) and I am calling a script (say script2.sh) within the script1.sh. Here in script1.sh I have a hash ( say %hash1) and i have to pass this hash to script2.sh. Basically i have to do some processing in Scirpt2.sh based on the hash(key,values). I wanted to know how can... (2 Replies)
Can Someone explain me why even using Tie::IxHash I can not get the output data in the same order that it was inserted? See code below.
#!/usr/bin/perl
use warnings;
use Tie::IxHash;
use strict;
tie (my %programs, "Tie::IxHash");
while (my $line = <DATA>) {
chomp $line;
my(... (1 Reply)
Hi Everyone,
Can anyone help me how do i call hash variable in to sql query in perl. Please see the script below
i have defined two Hash %lc and %tab as below
$lc{'REFF'}='V_RES_CLASS';
$lc{'CALE'}='V_CAP_CLASS';
$lc{'XRPD'}='V_XFMR_CLASS';
$tab{'V_RES_CLASS'}='V_MFR_SERS';... (6 Replies)
Hi,
In Perl, is it possible to use a range of numbers with '..' as a key in a hash?
Something in like:
%hash = (
'768..1536' => '1G',
'1537..2560' => '2G'
);
That is, the range operation is evaluated, and all members of the range are... (3 Replies)
Hi All
I have a doubt and want to be cleared I am using
@array = (10, 20);
$rarray = \@array;
#print "$rarray\n";
#print "@$rarray\n";
$rr= \$array;
#print $$rr;
$rr++;
print $$rr;
As you can see the $rr contains the reference to the first element of the array , now as the... (5 Replies)
Hi,
I have an hashes of hash, where hash is dynamic, it can be n number of hash. i need to compare data_count values of all .
my %result (
$abc => {
'data_count' => '10',
'ID' => 'ABC122',
}
$def => {
'data_count' => '20',
'ID' => 'defASe',
... (1 Reply)
Discussion started by: asak
1 Replies
LEARN ABOUT MOJAVE
data::dumper::concise5.18
Data::Dumper::Concise(3) User Contributed Perl Documentation Data::Dumper::Concise(3)NAME
Data::Dumper::Concise - Less indentation and newlines plus sub deparsing
SYNOPSIS
use Data::Dumper::Concise;
warn Dumper($var);
is equivalent to:
use Data::Dumper;
{
local $Data::Dumper::Terse = 1;
local $Data::Dumper::Indent = 1;
local $Data::Dumper::Useqq = 1;
local $Data::Dumper::Deparse = 1;
local $Data::Dumper::Quotekeys = 0;
local $Data::Dumper::Sortkeys = 1;
warn Dumper($var);
}
So for the structure:
{ foo => "bar
baz", quux => sub { "fleem" } };
Data::Dumper::Concise will give you:
{
foo => "bar
baz",
quux => sub {
use warnings;
use strict 'refs';
'fleem';
}
}
instead of the default Data::Dumper output:
$VAR1 = {
'quux' => sub { "DUMMY" },
'foo' => 'bar
baz'
};
(note the tab indentation, oh joy ...)
If you need to get the underlying Dumper object just call "DumperObject".
Also try out "DumperF" which takes a "CodeRef" as the first argument to format the output. For example:
use Data::Dumper::Concise;
warn DumperF { "result: $_[0] result2: $_[1]" } $foo, $bar;
Which is the same as:
warn 'result: ' . Dumper($foo) . ' result2: ' . Dumper($bar);
DESCRIPTION
This module always exports a single function, Dumper, which can be called with an array of values to dump those values.
It exists, fundamentally, as a convenient way to reproduce a set of Dumper options that we've found ourselves using across large numbers of
applications, primarily for debugging output.
The principle guiding theme is "all the concision you can get while still having a useful dump and not doing anything cleverer than setting
Data::Dumper options" - it's been pointed out to us that Data::Dump::Streamer can produce shorter output with less lines of code. We know.
This is simpler and we've never seen it segfault. But for complex/weird structures, it generally rocks. You should use it as well, when
Concise is underkill. We do.
Why is deparsing on when the aim is concision? Because you often want to know what subroutine refs you have when debugging and because if
you were planning to eval this back in you probably wanted to remove subrefs first and add them back in a custom way anyway. Note that this
-does- force using the pure perl Dumper rather than the XS one, but I've never in my life seen Data::Dumper show up in a profile so "who
cares?".
BUT BUT BUT ...
Yes, we know. Consider this module in the ::Tiny spirit and feel free to write a Data::Dumper::Concise::ButWithExtraTwiddlyBits if it makes
you happy. Then tell us so we can add it to the see also section.
SUGARY SYNTAX
This package also provides:
Data::Dumper::Concise::Sugar - provides Dwarn and DwarnS convenience functions
Devel::Dwarn - shorter form for Data::Dumper::Concise::Sugar
SEE ALSO
We use for some purposes, and dearly love, the following alternatives:
Data::Dump - prettiness oriented but not amazingly configurable
Data::Dump::Streamer - brilliant. beautiful. insane. extensive. excessive. try it.
JSON::XS - no, really. If it's just plain data, JSON is a great option.
AUTHOR
mst - Matt S. Trout <mst@shadowcat.co.uk>
CONTRIBUTORS
frew - Arthur Axel "fREW" Schmidt <frioux@gmail.com>
COPYRIGHT
Copyright (c) 2010 the Data::Dumper::Concise "AUTHOR" and "CONTRIBUTORS" as listed above.
LICENSE
This library is free software and may be distributed under the same terms as perl itself.
perl v5.18.2 2013-12-31 Data::Dumper::Concise(3)