#! /usr/bin/perl -w # scr02.pl # How to read any filename? # A simplest way to access a filename which an user supplies. $Filename = ""; print "Type a filename : "; $Filename = <STDIN>; chomp ($Filename); open (IN, $Filename); while (<IN>) { $incoming_line = $_; $line_length = length ($incoming_line); if ( $line_length >= 100 ) { print "Found a long line in $Filename : That is $_" } else { ; } ## Keep reading on. } close (IN)