in reply to my $var

A lexical variable -- a variable declared with my -- exists only while the scope its in is currently being executed. Perl uses reference counting for "garbage collection", if that helps you visualize the process.

The global, built-in variable $| allows you to turn on or off autoflush on the currently-selected output channel (STDOUT by default). This has nothing to do with lexical variables.