You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When $/ is set to "" and the entire file is read in with that setting, any sequence of consecutive newlines "\n\n" at the beginning of the file is discarded.
On testing, I find that a single newline at the beginning of the file is also discarded:
$ s='\na\nb\n\n12\n34\n\nhi'
$ printf'%b'"$s"| perl -00 -lnE 'say if $. == 1'
a
b
I don't think this is a bug, as this behavior is seen with awk too:
$ printf'%b'"$s"| awk -v RS= 'NR==1'
a
b
The text was updated successfully, but these errors were encountered:
Where
https://perldoc.perl.org/perlvar#$/
Description
The document says:
On testing, I find that a single newline at the beginning of the file is also discarded:
I don't think this is a bug, as this behavior is seen with
awktoo:The text was updated successfully, but these errors were encountered: