###################################
# SoftAfzar.Net
#!/usr/bin/perl -w
# Written by Enrique Hernandez
# FILE I/O Example!
# http://planetsourcecode.com/vb/scripts/ShowCode.asp?txtCodeId=221&lngWId=6
###################################
my ($file_buffer, $file_path, $i, $ans);
print "Please enter a file to read: ";
$ans = <STDIN>; chomp($ans);
# Make user tell us what file to read.
$file_path = $ans;
# If true
if(open(FH, $file_path))
{
# While still receiving data
while($file_buffer = <FH>)
{
$i++;
if($i == 10)
{
system("Pause");
$i=0;
}
print $file_buffer;
}
close(FH);
# We can close the file here
# since we just got off the while loop
# it signifies that were done reading...
}
else
{
die "Cannot open file; $!\n";
}
# close(FH); Can close it here as well
# instead of up there, same thing...
سوال برنامه نویسی دارید؟
ندونستن عیب نیست، نپرسیدن چرا!