10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hello Folks,
I have a DataDumper variable and the output of the dataDumper is printed in the below manner.
print Dumper \%mnemonics;
VAR1 = {
'SYS-7-CLI_SCHEDULER_LOG_STORED' => ,
'CRYPTO-6-IKMP_MODE_FAILURE' => ,
'AAAA-4-SERVUNDEF' => ,
... (1 Reply)
Discussion started by: scriptscript
1 Replies
2. Shell Programming and Scripting
Experts,
I am looking to compare elements of 2 array using perl. Below is not the actual code but logic wise something like this.
my $version = "MYSQlcl-5.2.4-264.x86_64"; <-- split this word into array as (5 2 4 264) ( which is to extract only the version number from the package name)
my... (1 Reply)
Discussion started by: solaix14
1 Replies
3. Shell Programming and Scripting
Hi,
Please find below the xsd.
<?xml version="1.0" encoding="ISO-8859-1" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="fruitorder">
<xs:complexType>
<xs:sequence>
<xs:element name="orderperson"... (2 Replies)
Discussion started by: vanitham
2 Replies
4. Shell Programming and Scripting
Hello,
I have the following perl array:
@longname = (Fasthernet0/0 Fasthernet0/1 Serial0/1/0 Serial0/2/1 Tunnel55 Tunnel77)
with the followinh array:
@shortname = (Fa0/0 Fa0/1 Se0/1/0 Se0/2/1 Tu55 Tu77)
in other words, I need to remove the following from each element in the array... (4 Replies)
Discussion started by: ahmed_zaher
4 Replies
5. Shell Programming and Scripting
hi
every resource i see regarding DBI refers to retrieving data from a database into and array or a hash, but i havent seen anything on how to pull out a single value to a scalar
in my database i have a field called "forcewrite" with a value of "6". I am trying to connect to the database,... (2 Replies)
Discussion started by: hcclnoodles
2 Replies
6. Shell Programming and Scripting
I need to use array elements while pattern matching.
@myarr = (ELEM1, ELEM2, ELEM3);
following is the statement which I am using in my code. Basically I want to replace the ELEM1/2/3 with other thing which is mentioned as REPL here.
if (condition) {
s/(ELEM1|ELEM2|ELEM3): REPL: /;
}
I... (3 Replies)
Discussion started by: deo_kaustubh
3 Replies
7. Shell Programming and Scripting
I am trying to use a script to replace the header of each file, whose filename are stored within the array $test, using the sed command within a Perl script as follows:
$count = 0;
while ( $count < $#test )
{
`sed -e 's/BIOGRF 321/BIOGRF 332/g' ${test} > 0`;
`cat 0 >... (2 Replies)
Discussion started by: userix
2 Replies
8. Shell Programming and Scripting
Hello,
I have a comma delimited input feed file. The first field has directory location and the second field has file name.
Ex of input feed:
/export/appl/a,abc*.dat
/export/appl/b,xyz*.dat
/export/appl/c,pmn*.dat
Under each directory, there would be many files like...
.
.
.... (4 Replies)
Discussion started by: bperl
4 Replies
9. Shell Programming and Scripting
When reading over some perl code in a software document, I came across an assignment statement like this
$PATH = ${PROJECT}/......./....
In this particular form of scalar variable assignment, what does the curly braces operators do ? Also, what is the benefit in doing scalar assignment this... (3 Replies)
Discussion started by: JamesGoh
3 Replies
10. Shell Programming and Scripting
hi
I've been searching all over the internet to simply do the following:
$tempfile = "/usr/school/tempfile.dat";
$myvar = param('add'); ###add is the variable assigned to a popup menu
`ls -l $myvar * >> $tempfile` ###I also tried `ls -l ${myvar}* >>$tempfile`
open(ADDLIST,... (6 Replies)
Discussion started by: mehdi9
6 Replies
Shell::Perl::Dumper(3pm) User Contributed Perl Documentation Shell::Perl::Dumper(3pm)
NAME
Shell::Perl::Dumper - Dumpers for Shell::Perl
SYNOPSYS
use Shell::Perl::Dumper;
$dumper = Shell::Perl::Dumper::Plain->new;
print $dumper->dump_scalar($scalar);
print $dumper->dump_list(@list);
DESCRIPTION
In "pirl", the result of the evaluation is transformed into a string to be printed. As this result may be a pretty complex data structure,
the shell provides a hook for you to pretty-print these answers just the way you want.
By default, "pirl" will try to convert the results via "Data::Dump". That means the output will be Perl code that may be run to get the
data structure again. Alternatively, the shell may use "Data::Dumper" or "Data::Dump::Streamer" with almost the same result with respect
to the representation as Perl code. (But the output of the modules differ enough for sufficiently complex data.)
Other options are to set the output to produce YAML or a plain simple-minded solution which basically turns the result to string via simple
interpolation.
All of these are implemented via dumper objects. Dumpers are meant to be used like that:
$dumper = Some::Dumper::Class->new; # build a dumper
$s = $dumper->dump_scalar($scalar); # from scalar to string
$s = $dumper->dump_list(@list); # from list to string
METHODS
The following methods compose the expected API of a dumper, as used by Shell::Perl.
new
$dumper = $class->new(@args);
Constructs a dumper.
dump_scalar
$s = $dumper->dump_scalar($scalar);
Turns a scalar into a string representation.
dump_list
$s = $dumper->dump_list(@list);
Turns a list into a string representation.
is_available
$ok = $class->is_available
This is an optional class method. If it exists, it means that the class has external dependencies (like "Shell::Perl::Data::Dump"
depends on "Data::Dump") and whether these may be loaded when needed. If they can, this method returns true. Otherwise, returning false
means that a dumper instance of this class probably cannot work. This is typically because the dependency is not installed or cannot be
loaded due to an installation problem.
This is the algorithm used by Shell::Perl XXX XXX XXX
1.
THE STANDARD DUMPERS
Shell::Perl provides four standard dumpers:
* Shell::Perl::Data::Dump
* Shell::Perl::Data::Dumper
* Shell::Perl::Data::Dump::Streamer
* Shell::Perl::Dumper::YAML
* Shell::Perl::Dumper::Plain
which corresponds to the four options of the command " :set out ": "D", "DD", "DDS", "Y", and "P" respectively.
Data::Dump
The package "Shell::Perl::Data::Dump" implements a dumper which uses Data::Dump to turn Perl variables into a string representation.
It is used like this:
use Shell::Perl::Dumper;
if (!Shell::Perl::Data::Dump->is_available) {
die "the dumper cannot be loaded correctly"
}
$dumper = Shell::Perl::Data::Dump->new;
print $dumper->dump_scalar($scalar);
print $dumper->dump_list(@list);
Examples of its output:
pirl > :set out D
pirl > { a => 3 } #scalar
{ a => 3 }
pirl > (1, 2, "a") #list
(1, 2, "a")
Data::Dumper
The package "Shell::Perl::Data::Dumper" implements a dumper which uses Data::Dumper to turn Perl variables into a string representation.
It is used like this:
use Shell::Perl::Dumper;
if (!Shell::Perl::Data::Dumper->is_available) {
die "the dumper cannot be loaded correctly"
}
$dumper = Shell::Perl::Data::Dumper->new;
print $dumper->dump_scalar($scalar);
print $dumper->dump_list(@list);
Examples of its output:
pirl > :set out DD
pirl > { a => 3 } #scalar
@var = (
{
'a' => 3
}
);
pirl > (1, 2, "a") #list
@var = (
1,
2,
'a'
);
YAML
The package "Shell::Perl::Dumper::YAML" implements a dumper which uses YAML::Syck or YAML to turn Perl variables into a string
representation.
It is used like this:
use Shell::Perl::Dumper;
if (!Shell::Perl::Dumper::YAML->is_available) {
die "the dumper cannot be loaded correctly"
}
$dumper = Shell::Perl::Dumper::YAML->new;
print $dumper->dump_scalar($scalar);
print $dumper->dump_list(@list);
Examples of its output:
pirl > :set out Y
pirl @> { a => 3 } #scalar
---
a: 3
pirl @> (1, 2, "a") #list
--- 1
--- 2
--- a
When loading, "YAML::Syck" is preferred to "YAML". If it is not avaiable, the "YAML" module is the second option.
Data::Dump::Streamer
The documentation is yet to be written.
Plain Dumper
The package "Shell::Perl::Dumper::Plain" implements a dumper which uses string interpolation to turn Perl variables into strings.
It is used like this:
use Shell::Perl::Dumper;
$dumper = Shell::Perl::Dumper::Plain->new;
print $dumper->dump_scalar($scalar);
print $dumper->dump_list(@list);
Examples of its output:
pirl > :set out P
pirl > { a => 3 } #scalar
HASH(0x1094d2c0)
pirl > (1, 2, "a") #list
1 2 a
SEE ALSO
Shell::Perl
BUGS
Please report bugs via CPAN RT <http://rt.cpan.org/NoAuth/Bugs.html?Dist=Shell-Perl> or <mailto://bugs-Shell-Perl@rt.cpan.org>.
AUTHORS
Adriano R. Ferreira, <ferreira@cpan.org>
Caio Marcelo, <cmarcelo@gmail.com>
COPYRIGHT AND LICENSE
Copyright (C) 2007aXX2011 by Adriano R. Ferreira
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
perl v5.10.1 2011-03-10 Shell::Perl::Dumper(3pm)