comparison _test/temp.pl @ 398:38cb0b80e88e

minor changes
author sergey
date Thu, 08 May 2014 03:53:17 +0400
parents 212cc86e470b
children f23fcb19d3c1
comparison
equal deleted inserted replaced
397:73f81f4e9570 398:38cb0b80e88e
1 #!/usr/bin/perl 1 #!/usr/bin/perl
2 use strict; 2 use strict;
3 3
4 use Time::HiRes qw(gettimeofday tv_interval); 4 my $p = 'sometype';
5 my $c = 'My::App::aSomeType';
5 6
6 my $hash = { 7 my $suffix = substr($c, -length($p));
7 x => 2.0, 8 my $prefix = substr($c, 0, -length($p));
8 y => 2.0, 9 print join ("\n",$suffix,$prefix,$p,$c), "\n";
9 z => 2.3,
10 w => 1.0
11 };
12 10
13 my $t = [gettimeofday]; 11 print $prefix && not(substr($prefix,-2) eq '::') ? 'corrupted' : 'class' ;
14
15 for(my $i = 0; $i < 1000000; $i ++) {
16 $hash->{x} = $i;
17 }
18
19
20 print "HASH: ",tv_interval($t,[gettimeofday]),"\n";
21
22
23 my $array = [2,2,2.3,1.0];
24
25 $t = [gettimeofday];
26
27 for(my $i = 0; $i < 1000000; $i ++) {
28 $array->[1] = $i;
29 }
30
31 print "ARRAY: ",tv_interval($t,[gettimeofday]),"\n";