If I understand your question correctly
perl -i might also do the trick (see
perlrun for details, or type
perldoc perlrun on your machine if www.perldoc.com is down):
perl -i -p -e '
BEGIN {
print "what length?\n";
$sequenceLength = getc;
}
s/$/$sequenceLength/' seq.txt
will print the same question you asked
for and add it to all lines in the file seq.txt.
Note that your getccall will only fetch 1 character, so if I answer '33' to the first question, it will only add a '3'. You might want to replace the getc part with something like:
$sequenceLength = <STDIN>; chomp($sequenceLength);
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.