Angus Laughland, who did not know the girl, exchanged text messages with her after getting hold of her number by chance through a third party.
Perth Sheriff Court heard that Laughland's messages to the girl became sexually explicit.
The 62-year-old was jailed for 220 days after admitting the offence.
The court was told that one of the first texts received by the girl read: "I'm not a person as such, just call me cyber buddy."
Shortly after Laughland started sending the messages, he guessed the girl was around "13 or 14" and she confirmed that she was.
The court was told the messages became sexually explicit, with one making reference to the girl's private parts.
On 11 October Laughland sent a message saying he taught guitar and that he wanted to meet the girl to give her a guitar as a gift.
The meeting took place the following day.
When the girl got home, her mother asked her about the guitar and they discussed the issue with the girl's grandmother.
The teenager's family then contacted the police,
Laughland admitted sending explicit texts to a 13-year-old girl between 16 September and 12 October 2014.
Solicitor Paul Ralph, defending, said: "It started as a grave error of judgement.
"It developed so far beyond that, that it's very difficult for us to really describe how he got himself into that situation."
Sheriff Fiona Tait said: "We ought not to lose sight of what this offence was.
"He described sexual intercourse in detail and also met the child. The difficulty he faces is the gravity of the offence.
"He met the child and gave her the guitar. That shows precisely how vulnerable she was."

Colin Patterson, 51, from Newcastle, contacted a fake profile created by the Dark Justice group.
During conversations on the internet, he asked for sex, sent naked pictures and arranged a meeting.
The former shipyard worker had admitted attempting to meet a child following sexual grooming at a previous hearing.
At Newcastle Crown Court, prosecutor Tim Gittins said the vigilante group had set up the profile on the website Badoo as a girl named Tasha.
"They were careful that contact was initiated by the defendant and he contacted the profile in January," he said.
"It was made clear to him immediately that he was conversing with a 14-year-old and asked if that was acceptable to him.
"The defendant's conversations moved quickly towards sexual matters and asking to meet her."
Mr Gittins said Patterson sent two pictures of his genitalia, which was part of the 120 pages of conversation between them.
A rendezvous was arranged at the Centre for Life, in Newcastle city centre.
When Dark Justice arrived they stopped a passing policeman who arrested Patterson.
Jailing him, Judge Penny Moreland also placed him on the sex offenders' register for 10 years and made a sexual harm prevention order lasting for 10 years.
Shaun Routledge, defending, said: "He does not seek to blame anybody but himself and there are clear indications of remorse."
Dark Justice, who are a two-man team, welcomed the sentence and said their work had now resulted in 18 arrests.
A Blairgowrie music teacher who groomed a 13-year-old girl and met her after promising to give her a guitar has been jailed.
[NEXT_CONCEPT]
A man who thought he was meeting a 14-year-old girl for sex but had been ensnared by internet paedophile hunters has been jailed for two years.