10-10-2012
Usually hash is just a random storage partial key, so it feels like we need the outer code and app to understand the problem. Is this like a top 10 scoring problem?
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I have a script with dynamic hash of hashes , and I want to print the entire hash (with all other hashes).
Itried to do it recursively by checking if the current key is a hash and if yes call the current function again with refference to the sub hash.
Most of the printing seems to be OK but in... (1 Reply)
Discussion started by: Alalush
1 Replies
2. Shell Programming and Scripting
hi there, I have some database output that looks like this
SELECT nic_name,nic_duplex,nic_speed,nic_ip FROM network_table WHERE hostname = "server1"
result is this (ive delimited with a pipe for ease of reading)
bge0|full|1000|10.32.100.1
bge1|full|1000|11.12.101.7 ... (1 Reply)
Discussion started by: hcclnoodles
1 Replies
3. Shell Programming and Scripting
Hi there
I have a hash of hashes made up of the following data
bge0|100|half|10.36.100.21
bge1|1000|full|10.36.100.22
bge2|1000|full|10.36.100.23
which when i turn into a hash, would look like this inside the system
bge0 ->
nic_speed -> 100
nic_duplex -> half
... (6 Replies)
Discussion started by: hcclnoodles
6 Replies
4. Shell Programming and Scripting
Hi, sorry, two hash related questions in one day .. but this has got me a bit stuck.
I have a mysql database table that kind of looks like this, the table is called "view1" and a snippet of that table (SELECT'ing just rows with serial number 0629AN1200) is below
serial nic_name ... (2 Replies)
Discussion started by: hcclnoodles
2 Replies
5. Shell Programming and Scripting
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)
Discussion started by: jgfcoimbra
1 Replies
6. Shell Programming and Scripting
hi all,
i have a small problem regarding sorting the keys in a hash.
my %hash;
for($i=0;$i<19;$i++)
{
$hash{$i}=$i;
}
foreach $c (sort keys %hash)
{
print "\n $hash{$c}";
} (1 Reply)
Discussion started by: niteesh_!7
1 Replies
7. Shell Programming and Scripting
Hi there, I am trying to dereference my hash of hashes but post dereferencing, it seems to lose its structure I am using Data::dumper to help me anaylise.
This is the code im using to build the HoH, (data comes from a file). I have also performed a Dumper on the data structure before and after... (1 Reply)
Discussion started by: rethink
1 Replies
8. Shell Programming and Scripting
Hi Folks
I am very much a newbie at perl but picking it up and I'm hoping you can help.
I have a file input that details all the /etc/group files in our enterprise in the following format: "<host>:<group>:<gid>:<users>"
I want to parse this data display it as the following:... (9 Replies)
Discussion started by: g_string
9 Replies
9. Shell Programming and Scripting
I want to sort values of a hash in ascending order.
my %records;
for my $value (sort values %records){print $value,"\n";}
When I use the above code I get values in this order: 1,10,11,2,3,4,5,6,7,8,9. But, I need values in my output in this order: 1,2,3,4,5,6,7,8,9,10,11.
Can Someone... (1 Reply)
Discussion started by: koneru_18
1 Replies
10. Shell Programming and Scripting
Hello experts. I'm having problems with a snippet of code.
I was hoping to get help/advice to correct.
A file that this script parses has changed to the point where
I can no longer use a scalar, it looks as though I need to
create an array for a hash of hashes below.
The first output of... (1 Reply)
Discussion started by: timj123
1 Replies
LEARN ABOUT DEBIAN
plack::middleware::conditional
Plack::Middleware::Conditional(3pm) User Contributed Perl Documentation Plack::Middleware::Conditional(3pm)
NAME
Plack::Middleware::Conditional - Conditional wrapper for Plack middleware
SYNOPSIS
use Plack::Builder;
builder {
enable_if { $_[0]->{REMOTE_ADDR} eq '127.0.0.1' } 'StackTrace', force => 1;
$app;
};
# or using the OO interface:
$app = Plack::Middleware::Conditional->wrap(
$app,
condition => sub { $_[0]->{REMOTE_ADDR} eq '127.0.0.1' },
builder => sub { Plack::Middleware::StackTrace->wrap($_[0], force => 1) },
);
DESCRIPTION
Plack::Middleware::Conditional is a piece of meta-middleware, to run a specific middleware component under runtime conditions. The goal of
this middleware is to avoid baking runtime configuration options in individual middleware components, and rather share them as another
middleware component.
EXAMPLES
Note that some of the middleware component names are just made up for the explanation and might not exist.
# Minify JavaScript if the browser is Firefox
enable_if { $_[0]->{HTTP_USER_AGENT} =~ /Firefox/ } 'JavaScriptMinifier';
# Enable Stacktrace when being accessed from the local network
enable_if { $_[0]->{REMOTE_ADDR} =~ /^10.0.1.*/ } 'StackTrace';
# Work with other conditional setter middleware:
# Transcode Jpeg on the fly for mobile clients
builder {
enable 'MobileDetector';
enable_if { $_[0]->{'plack.mobile_detected'} }
'TranscodeJpeg', max_size => 30_000;
$app;
};
Note that in the last example MobileDetector should come first because the conditional check runs in pre-run conditions, which is from
outer to inner: that is, from the top to the bottom in the Builder DSL code.
AUTHOR
Tatsuhiko Miyagawa
Steve Cook
SEE ALSO
Plack::Builder
perl v5.14.2 2012-04-14 Plack::Middleware::Conditional(3pm)