#!/usr/bin/perl -w use strict; #The below variable $mystring is used for some other example my $mystring = "http://192.168.153.238/nightly_results/2009_12_02/log_lcla114.lss.emc.com_64___TestSuitePPAll_TestSuitePPSym_TestSuitePPperf_TestSuitePPTx_TestSuitePPConCurrent_Prod_SymmSLV_AIX__3_15.html"; my $sample_sentence = "The kernel bitness: 64"; # ----------- The code corresponds to $mystring ------------# if($mystring =~ m/nightly_results(.*?)(.html)/) { my $web_link= "/nightly_db".$1; print $web_link; } if($mystring =~ m!([^/]+)$!){ my $file=$1; print "field= $file\n"; } #-----------Code ends corresponds to $myString -------------# #----------------- code corresponds to $sample_sentence -----------# print $sample_sentence =~ /kernel bitness:\s(\d*)/; #------------- COde ends here b--------------------#