Without an example of the output you expect and lacking a clear description of what you are trying to achieve it's rather hard to know what you want. However the following may give you something to think about:
use strict; use warnings; use 5.010; 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; for my $value (@values) { next if $value !~ /_$parts[1]_/; given ($value) { when (/(v09.11-[a-z]\d{3})/) {print "$1\n"; continue}; when (/(v09.10-[a-z]\d{3})/) {print "$1\n"; continue}; when (/(v08.\d{2}-[a-z]\d{3})/) {print "$1\n"; continue}; } }
Prints:
v09.11-s008 v09.10-p002 v08.11-e002
I've trimmed and edited the data somewhat to better suit what I guess you might be trying to do and reduce the size and noise in the sample.
In reply to Re: missing outputs
by GrandFather
in thread missing outputs
by blackgoat
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |