in reply to Re^2: removing the need for tmp files from script
in thread removing the need for tmp files from script
The link to open that BillKSmith mentioned in his post has the following text.
This shows how to write to an in-memory file.# in-memory files 21. open(my $memory, ">", \$var) 22. or die "Can't open memory file: $!"; 23. print $memory "foo!\n"; # output will appear in $var
To read from an in memory file, you would do this:
That would be a way to not need the tmp. file.#!/usr/bin/perl use strict; use warnings; my $file = 'here are some words I want '; open my $fh, '<', \$file; chomp(my @words = <$fh>); my $pattern = join "|", @words; print $pattern;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: removing the need for tmp files from script
by novice2015 (Acolyte) on Jul 29, 2016 at 21:15 UTC |