Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Re: Output to another file help

by roboticus (Chancellor)
on Nov 08, 2012 at 21:21 UTC ( #1002986=note: print w/ replies, xml ) Need Help??

in reply to [SOLVED] Output to another file help


You're treating $firstName as an array reference, but it's presumably a string. What you want to do is create a variable that holds the first initial, then you can print that. Something like this:

my $firstName = 'Marco'; my $firstInitial = substr($firstName, 0, 1); print "First initial is '$firstInitial'\n";

Read the documentation for substr to see how it works.


When your only tool is a hammer, all problems look like your thumb.

Comment on Re: Output to another file help
Select or Download Code
Replies are listed 'Best First'.
Re^2: Output to another file help
by jaffinito34 (Acolyte) on Nov 08, 2012 at 21:39 UTC

    Nevermind, found out about lc() function.

Re^2: Output to another file help
by jaffinito34 (Acolyte) on Nov 08, 2012 at 21:36 UTC

    PERFECT!, any ideas how to quickly convert the firstInitial to lowercase? Right now my script outputs the first initial, first 3 of the last name, and last 4 of ssn, but it does so that it looks like this:

    First, Last, 000-000-0000, etc...

    output: FLas0000

    I'm trying to get it like: flas0000

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1002986]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (4)
As of 2015-11-27 06:04 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (719 votes), past polls