> Whats a bash prompt??
A shell prompt (bash is a 'shell'). Otherwise known as
a command line. A place where you type in commands.
I guess you ain't using a flavor of unix.
If you're using Windows, you can do roughly the same
thing as I suggested, only you'll need to fiddle with the
characters that the shell treats specially, such as ', ",
and maybe $ and maybe others. For the particular
command line I suggested, I think you can just reverse
the single and double quotes:
perl -e "$_='barbar'; substr($_, 2, 2) = 'qux'; print"
Try it.
> Ok OK let me see if i have it
Yes, you do.
> so do i have to do this too?
> my $morestring;
> my substr($EightyCharsLong, 19, 10) = 'morestring';
You only have to use my if you are forcing yourself
to be strict about predeclaring variable names. This
is generally a good thing for anything but one liners.
To force yourself to be strict about a number of things
including predeclaring variables, put this near the top
of your code:
use strict;
You don't need to declare a $morestring. I didn't use
a $morestring. I used a literal 'morestring'.
But, regardless of my or no my, you can't do this:
substr($UninitializedVar, 5, 10) = 'foo';
because Perl will complain because $UninitializedVar
is zero length and you're trying to add a string at char
position 6 -- which doesn't exist.
My example assumed that $Eighty had been initialized.
hth.