Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

$ver = $1 if ( m/^[->]>\s+(.*)$/);

Status
Not open for further replies.

hujirong

Technical User
Aug 22, 2005
13
CA
Can anyone explain to me in details how the above work?

The objective I guess is to get the lines start with >> from the following output.

Thanks
Jirong

------------------- output -----

Comparing the following:

V70R2_TxNR_081219_030506_B159_GP1_429.741@\hppc_pvob

V70R2_TxND_090105_200105_B159_GP1_245.7893@\hppc_pvob

Differences:

>> M:\jhu_v7.0_r2_sustaining_int\hppc_src\GUIs\Assistant\forms\tacEmailDetails.frm@@\main\hppc_v7.0_
r1_integration\v7.0_r2_int\v7.0_r2_sustaining_int\19

>> M:\jhu_v7.0_r2_sustaining_int\hppc_src\Servers\Statistics\src\tsttclrdc.cpp@@\main\hppc_v7.0_r1_i
ntegration\v7.0_r2_int\v7.0_r2_sustaining_int\3

>> M:\jhu_v7.0_r2_sustaining_int\hppc_src\Servers\Statistics\include\tstsclrd.hpp@@\main\hppc_v7.0_r
1_integration\v7.0_r2_int\v7.0_r2_sustaining_int\1

>> M:\jhu_v7.0_r2_sustaining_int\hppc_src\Servers\Statistics\include\tsttagrdc.hpp@@\main\hppc_v7.0_
r1_integration\v7.0_r2_sustaining_int\1

>> M:\jhu_v7.0_r2_sustaining_int\hppc_src\Servers\Statistics\include\tsttagrd.hpp@@\main\hppc_v7.0_r
1_integration\v7.0_r2_int\v7.0_r2_sustaining_int\1

>> M:\jhu_v7.0_r2_sustaining_int\hppc_src\Servers\Statistics\include\tstsagst.hpp@@\main\hppc_v7.0_r
1_integration\v7.0_r2_sustaining_int\1
 
What was your question? The code in the subject worked fine...

Code:
[COLOR=red][kirsle@firefly ~]$[/color] cat test
while (<DATA>) {
	chomp;
	[b]my $ver = $1 if (m/^[->]>\s+(.*)$/);[/b]
	print "ver: $ver\n" if $ver;
}

__DATA__
Comparing the following:

  V70R2_TxNR_081219_030506_B159_GP1_429.741@\hppc_pvob

  V70R2_TxND_090105_200105_B159_GP1_245.7893@\hppc_pvob

Differences:

>> M:\jhu_v7.0_r2_sustaining_int\hppc_src\GUIs\Assistant\forms\tacEmailDetails.frm@@\main\hppc_v7.0_
r1_integration\v7.0_r2_int\v7.0_r2_sustaining_int\19

>> M:\jhu_v7.0_r2_sustaining_int\hppc_src\Servers\Statistics\src\tsttclrdc.cpp@@\main\hppc_v7.0_r1_i
ntegration\v7.0_r2_int\v7.0_r2_sustaining_int\3

>> M:\jhu_v7.0_r2_sustaining_int\hppc_src\Servers\Statistics\include\tstsclrd.hpp@@\main\hppc_v7.0_r
1_integration\v7.0_r2_int\v7.0_r2_sustaining_int\1

>> M:\jhu_v7.0_r2_sustaining_int\hppc_src\Servers\Statistics\include\tsttagrdc.hpp@@\main\hppc_v7.0_
r1_integration\v7.0_r2_sustaining_int\1

>> M:\jhu_v7.0_r2_sustaining_int\hppc_src\Servers\Statistics\include\tsttagrd.hpp@@\main\hppc_v7.0_r
1_integration\v7.0_r2_int\v7.0_r2_sustaining_int\1

>> M:\jhu_v7.0_r2_sustaining_int\hppc_src\Servers\Statistics\include\tstsagst.hpp@@\main\hppc_v7.0_r
1_integration\v7.0_r2_sustaining_int\1
[COLOR=red][kirsle@firefly ~]$[/color] perl test
ver: M:\jhu_v7.0_r2_sustaining_int\hppc_src\GUIs\Assistant\forms\tacEmailDetails.frm@@\main\hppc_v7.0_
ver: M:\jhu_v7.0_r2_sustaining_int\hppc_src\Servers\Statistics\src\tsttclrdc.cpp@@\main\hppc_v7.0_r1_i
ver: M:\jhu_v7.0_r2_sustaining_int\hppc_src\Servers\Statistics\include\tstsclrd.hpp@@\main\hppc_v7.0_r
ver: M:\jhu_v7.0_r2_sustaining_int\hppc_src\Servers\Statistics\include\tsttagrdc.hpp@@\main\hppc_v7.0_
ver: M:\jhu_v7.0_r2_sustaining_int\hppc_src\Servers\Statistics\include\tsttagrd.hpp@@\main\hppc_v7.0_r
ver: M:\jhu_v7.0_r2_sustaining_int\hppc_src\Servers\Statistics\include\tstsagst.hpp@@\main\hppc_v7.0_r

Cuvou.com | My personal homepage
Code:
perl -e '$|=$i=1;print" oo\n<|>\n_|_";x:sleep$|;print"\b",$i++%2?"/":"_";goto x;'
 
It looks for lines that start
Code:
>> x
-> y
and stores either the 'x' or the 'y' as the version. In this case the 'x' or 'y' includes all the characters after the space(s) up to the end of the line.

Steve

[small]"Every program can be reduced by one instruction, and every program has at least one bug. Therefore, any program can be reduced to one instruction which doesn't work." (Object::perlDesignPatterns)[/small]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top