Thanks haukex for help.

It will be grateful if you can help to correct below two queries :

Want to calculate the Time Stamp between date now and timereceived .

Getting error in pattern not matching ,can u share the correct pattern for "10/10/2017 11:35 PM"

#Begin###Calculate the time difference my $dtnow = DateTime->now; my $timereceived = "10/10/2017 11:35 PM"; my $strp = DateTime::Format::Strptime->new(on_error=>'croak',pattern = +> '%m/%d/%Y %H:%M %t', time_zone=>'UTC'); my $dtevent = $strp->parse_datetime($timereceived); my $diff_sec = $dtnow->subtract_datetime_absolute($dtevent)->in_units( +'seconds'); my $diff_hours = sprintf("%.0f" , $diff_sec/(60*60)); #End###Calculate the time difference

Another query in expression formatting ---

my name = 'greenfield (Glossary) (100)' foreach ( $name =~ /\((.*?)\)/ ) { $appID = $1; }

variable $name is having two value in two different brackets (Glossary) and (100) with below regular expression i am getting output as

'appid' => 'Glossary'

But i want 'appid' => '100'

it should avoid the first bracket (Glossary) values and only last (100) bracket vales it should pick

-Thanks.

In reply to Re^2: XML data extraction (updated x2) by snehit.ar
in thread XML data extraction by snehit.ar

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.