#!/usr/bin/perl -w
use strict;
use warnings;
use diagnostics;
use feature 'say';
my@array = qw(a b c d e f g h i j k l m n o p q r s t u v w x y z);
my@array_a = @array[0..5];
my@array_b = @array[6..8];
my@array_c = @array[8..15];
my@array_d = @array[16..16];
my@array_e = @array[17..20];
my@array_f = @array[21..24];
my@array_g = @array[25..16];
print "first five string:",@array_a,"\n";
print @array_b,"\n";
print @array_c,"\n";
print @array_d,"\n";
print @array_e,"\n";
print @array_f,"\n";
print @array_g;
I have a above Perl script that Prints the results of the script on the terminal screen. Instead of having the information printed on the screen, I need it to save it to a text file.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.