in reply to Re: Get only 1KB from text File
in thread Get only 1KB from text File
If you miss that little detail, "local" is equivalent to "main".{ local $/=\"1024"; open FILE, 'c:\space\sp.txt' or die $!; $_=<FILE>; #<IT WILL READ ONLY 1KB> } # now $/ is back to its original value # another way (note that quotes are not needed): open FILE, $name or die $!; $_ = do { local $/ = \1024; <FILE> };
But really, just using "read()" seems easier.
|
|---|