Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

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.

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 all is quiet...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (9)
As of 2018-06-18 16:20 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (110 votes). Check out past polls.