use strict; use warnings; use 5.010; use CGI qw(); my $date = 'Wed Mar 10 10:10:48 IST 2010'; my @parts = split /[ :]/, $date; my $valueStr = <<VALS; Fri_Jan_29_14:30:22_v09.11-e024_1 Wed_Jan_27_14:30:11_v09.11-e022_1 Mon_Mar_08_14:30:04_v09.11-s008_1 Thu_Jan_28_14:30:13_v09.11-e023_1 Tue_Nov_24_15:54:18_v09.11-e005_1 Tue_Mar_01_14:30:08_v09.10-p002_1 Tue_Nov_24_17:31:07_v09.10-p001_1 Wed_Nov_25_10:27:43_v09.11-e002_1 Wed_Mar_25_10:27:43_v08.11-e002_1 VALS my @values = split /[\s\n]+/, $valueStr; my $cgi = CGI->new (); print $cgi->header (); print $cgi->start_html (); for my $value (@values) { next if $value !~ /_$parts[1]_/; given ($value) { when (/(v09.11-[a-z]\d{3})/) {print $cgi->p ($1); continue} +; when (/(v09.10-[a-z]\d{3})/) {print $cgi->p ($1); continue} +; when (/(v08.\d{2}-[a-z]\d{3})/) {print $cgi->p ($1); continue} +; } } print $cgi->end_html ();

Prints:

Content-Type: text/html; charset=ISO-8859-1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-U +S"> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1 +" /> </head> <body> <p>v09.11-s008</p><p>v09.10-p002</p><p>v08.11-e002</p> </body> </html>

True laziness is hard work

In reply to Re^3: missing outputs by GrandFather
in thread missing outputs by blackgoat

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.