Created
November 21, 2023 17:40
-
-
Save ApexExpress/dd271c816cabbad2e1a1260426e9ccda to your computer and use it in GitHub Desktop.
Generally A Perl File
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
# Open the file for reading | |
my $file_path = "data.txt"; | |
open my $fh, '<', $file_path or die "Could not open file '$file_path' for reading: $!"; | |
# Read and print each line from the file | |
while (my $line = <$fh>) { | |
chomp $line; # Remove newline character | |
print "Line from file: $line\n"; | |
} | |
# Close the filehandle | |
close $fh or die "Error closing file '$file_path': $!"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment