Help for this page

Select Code to Download


  1. or download this
    use strict;
    
  2. or download this
    use warnings; # as well!
    
  3. or download this
    my $countline = 0;
    my $mytest;
    open (MYFILE,"<testing.txt")||die "Could not open input file\n";
    
  4. or download this
    open my $fh, '<', "testing.txt" or die "Could not open input file: $!\
    +n";
    
  5. or download this
    while($mytest = <MYFILE>) {
    
  6. or download this
    while( defined($mytest = <MYFILE>) ) {
    
  7. or download this
    while(<MYFILE>) {
    
  8. or download this
             my @datas= split (/\s+/, $mytest);
             
    
    
           if ($datas[0] eq "Hello")
    
  9. or download this
           if ( (split /\s+/, $mytest)[0] eq "Hello" )
    
  10. or download this
           if ( (split)[0] eq "Hello" )
    
  11. or download this
           $countline++ if +(split)[0] eq "Hello";
    
  12. or download this
    my @test1 = $countline;
    print $test1[0];
    
  13. or download this
    while (<>) { push @wanted, $_ if +(split)[0] eq "Hello" }