diff options
author | Marcel Ribeiro Dantas <ribeirodantasdm@gmail.com> | 2022-06-27 00:28:16 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-27 00:28:16 +0200 |
commit | 5d133e847846b4c8d436f7a567674c2e1df35a13 (patch) | |
tree | 7ebc7704f02ceef195a8896a80a06ed81cc12585 /perl.html.markdown | |
parent | 27f7f03401ff747a61a912fdf73549b1788b13e1 (diff) | |
parent | 8f28c8021b8ce3cb791861ad19c41e12228d8bcd (diff) |
Merge branch 'master' into patch-1
Diffstat (limited to 'perl.html.markdown')
-rw-r--r-- | perl.html.markdown | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/perl.html.markdown b/perl.html.markdown index 8811dd08..88185e9d 100644 --- a/perl.html.markdown +++ b/perl.html.markdown @@ -217,6 +217,12 @@ open(my $log, ">>", "my.log") or die "Can't open my.log: $!"; my $line = <$in>; my @lines = <$in>; +# You can iterate through the lines in a file one at a time with a while loop: + +while (my $line = <$in>) { + print "Found apples\n" if $line =~ m/apples/; +} + # You can write to an open filehandle using the standard "print" # function. |