#!/usr/local/bin/perl -w use strict; open TEMP, "+>file.txt" or die "Error message here: $!\n"; # Write to the file print TEMP "aba uba\niba seba\njak yuk\n"; # Rewind the file for reading seek(TEMP, 0, 0); while () { print; } close TEMP;