in reply to Re: How to acess Hash data
in thread [untitled node, ID 1080084]

Replies are listed 'Best First'.
Re^3: How to acess Hash data
by kcott (Archbishop) on Mar 29, 2014 at 20:00 UTC
    "Thanks for your reply ..."

    Thanking me is all well and good; however, as far as I can see, you've completely ignored every point and recommendation I made.

    As you've provided some more code and input data, here's my best guess at the type of thing you want:

    #!/usr/bin/env perl use strict; use warnings; use autodie; my $report_file = 'pm_1080084_timing_manual.rpt'; my %PG; local $/ = "\nStartpoint"; open my $fh, '<', $report_file; while (<$fh>) { /[(](\w+)[^(]+[(](\w+)[^:]+:\s+(\w+).*?slack[^-]+(-\d+)/s; $PG{$3}{"$1-$2"} = $4; } use Data::Dump; dd \%PG;

    This outputs:

    { PLBCLK => { "input-output" => -4, "rising-output" => -3 }, PLBCLK1 => { "input-rising" => -1, "rising-rising" => -2 }, }

    If you choose to ignore the points I raise, the links I provide, and the recommendations I make, that's fine. Of course, it would be a waste of my time to offer further help if it's going to be ignored.

    -- Ken

          The regex has no syntax that was added after Perl version 5.6, so YAPE::Regex::Explain may be helpful.

          c:\@Work\Perl\monks>perl -wMstrict -le "use YAPE::Regex::Explain; ;; my $rx = qr/[(](\w+)[^(]+[(](\w+)[^:]+:\s+(\w+).*?slack[^-]+(-\d+)/s; ;; print YAPE::Regex::Explain->new($rx)->explain; " The regular expression: (?s-imx:[(](\w+)[^(]+[(](\w+)[^:]+:\s+(\w+).*?slack[^-]+(-\d+)) matches as follows: NODE EXPLANATION ---------------------------------------------------------------------- (?s-imx: group, but do not capture (with . matching \n) (case-sensitive) (with ^ and $ matching normally) (matching whitespace and # normally): ---------------------------------------------------------------------- [(] any character of: '(' ---------------------------------------------------------------------- ( group and capture to \1: ---------------------------------------------------------------------- \w+ word characters (a-z, A-Z, 0-9, _) (1 or more times (matching the most amount possible)) ---------------------------------------------------------------------- ) end of \1 ---------------------------------------------------------------------- [^(]+ any character except: '(' (1 or more times (matching the most amount possible)) ---------------------------------------------------------------------- [(] any character of: '(' ---------------------------------------------------------------------- ( group and capture to \2: ---------------------------------------------------------------------- \w+ word characters (a-z, A-Z, 0-9, _) (1 or more times (matching the most amount possible)) ---------------------------------------------------------------------- ) end of \2 ---------------------------------------------------------------------- [^:]+ any character except: ':' (1 or more times (matching the most amount possible)) ---------------------------------------------------------------------- : ':' ---------------------------------------------------------------------- \s+ whitespace (\n, \r, \t, \f, and " ") (1 or more times (matching the most amount possible)) ---------------------------------------------------------------------- ( group and capture to \3: ---------------------------------------------------------------------- \w+ word characters (a-z, A-Z, 0-9, _) (1 or more times (matching the most amount possible)) ---------------------------------------------------------------------- ) end of \3 ---------------------------------------------------------------------- .*? any character (0 or more times (matching the least amount possible)) ---------------------------------------------------------------------- slack 'slack' ---------------------------------------------------------------------- [^-]+ any character except: '-' (1 or more times (matching the most amount possible)) ---------------------------------------------------------------------- ( group and capture to \4: ---------------------------------------------------------------------- - '-' ---------------------------------------------------------------------- \d+ digits (0-9) (1 or more times (matching the most amount possible)) ---------------------------------------------------------------------- ) end of \4 ---------------------------------------------------------------------- ) end of grouping ----------------------------------------------------------------------

          Update: Also see davido's on-line Perl Regular Expression Tester for post-5.6 syntax.

            Begging you pardon, I cannot see the Perl question in your last post.

            Edit: maybe you clarify what the difference between those text blocks is (it is not apparent to me)
            or even better: mention the small misconception or the detail that does not work in your favour and what you expected it to do.

            Cheers, Sören

            Créateur des bugs mobiles - let loose once, run everywhere.
            (hooked on the Perl Programming language)