in reply to Re: Get only 1KB from text File
in thread Get only 1KB from text File

Bear in mind that "local $/..." will only be "local" if it's inside a curly-brace block:
{ 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> };
If you miss that little detail, "local" is equivalent to "main".

But really, just using "read()" seems easier.