fork download
  1. #!/usr/bin/perl
  2. # your code goes here
  3. use strict;
  4. use warnings;
  5. while(chomp(my $line = <DATA>)) {
  6. if ( $line =~ m$^\[=.*?]$ ){
  7. print "Line which starts with [==] is $line\n";
  8. }
  9. }
  10. __DATA__
  11. [==========] 10 tests from 4 test cases ran. (43950 ms total)
  12. A line without the equal signs at the beginning
  13. [==========] 4 tests from 2 test cases ran. (30950 ms total)
  14. [===]A line with equal signs at beginning.
  15.  
Success #stdin #stdout #stderr 0s 3740KB
stdin
Standard input is empty
stdout
Line which starts with [==] is [==========] 10 tests from 4 test cases ran. (43950 ms total)
Line which starts with [==] is [==========] 4 tests from 2 test cases ran. (30950 ms total)
Line which starts with [==] is [===]A line with equal signs at beginning.
stderr
Use of uninitialized value $line in chomp at prog.pl line 5, <DATA> line 4.